DLL Programmer's Guide for TNS/E Systems
Dynamic Use of DLLs
DLL Programmer’s Guide for TNS/E Systems—527252-006
3-5
Returned Value of dlopen
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 DLL, 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.
When dlopen() returns 0, call dlerror() for a textual description of the error, or
dlresultcode() for an encoded error code and error-detail.
Accessing Symbols (dlsym)
Using the handle returned to the calling process by dlopen(), that process can
access a named symbol if it is exported by the targeted DLL or any library in its
loadList. dlsym() is the only way to access symbols in a dynamically loaded library;
but it also allows a process to obtain the address of a symbol exported by any currently
loaded loadfile for which the process has a dlopen handle or by the libraries in that
loadfile’s loadList. The following function call invokes dlsym():
void *dlsym(dlhandle dlopen_handle, const char *symbol_name)
The parameters of dlsym are:
dlopen_handle










