DLL Programmer's Guide for TNS/R Systems
Dynamic Use of DLLs
DLL Programmer’s Guide for TNS/R Systems—522203-002
3-4
Returned Value of dlopen
3 - also show files loaded
4 - also show symbol resolution
5 - same as 3, plus file search details
6 - same as 4, plus file search details
7 - same as 4, plus symbol search details
8 - all the above
dlopen() treats the mode parameter as the union of the above values and detects an
error if any other value is used. Valid combinations for the mode parameter are as
follows:
•
Exactly one from the set of ( RTLD_NOW | RTLD_LAZY | RTLD_NOLOAD ) and
•
No More than one from the set of ( RTLD_GLOBAL | RTLD_LOCAL )
This means that if RTLD_NOLOAD is specified the user cannot set RTLD_NOW or
RTLD_LAZY, however, the user can, optionally, set RTLD_GLOBAL or RTLD_LOCAL.
Each valid combination can be combined with the verbosity level, via
RTLD_VERBOSE(verbosity_level) to create the mode parameter.
Returned Value of dlopen
dlopen returns a handle (value) for the calling process to use in subsequent calls to the
dlopen target. This handle is not usable in any other way; in particular, it is not an
address.
dlopen (with dlsym) is the only way for DLLs in the prior operating load set to access
symbols exported by DLLs in the (dynamically loaded) added load set. Furthermore,
any running loadfile can name any currently loaded DLL as a dlopen target and get a
handle to access the exported symbols of that DLL and the libraries in its loadList.
When the dlopen target is 0, dlopen returns a handle for the main program.
Error-Returned Value of dlopen
A returned value of 0 indicates an error, which can occur for any of the following
reasons:
•
The object_pathname parameter pointed out of bounds or to a malformed
name.
•
dlopen could not find or could not open the specified file.
•
The specified file was neither a DLL nor a public SRL, or was not valid.
•
An error occurred while the loader was loading the specified file or adjusting its
symbolic references.
•
A target DLL specified with RTLD_NOLOAD mode was not already loaded.
•
The mode parameter value is invalid.