DLL Programmer's Guide for TNS/E Systems
Dynamic Use of DLLs
DLL Programmer’s Guide for TNS/E Systems—527252-006
3-3
dlopen’s Mode Parameter Values
*object_pathname is either zero (NULL) or a pointer to the null-terminated file
name (string) of the DLL to open and load, which is called herein the dlopen target.
mode is an enumeration of options that control symbol resolution and loading, as
described in dlopen’s Mode Parameter Values below.
When the object_pathname parameter is zero, the loader does not load anything, but
returns a handle that enables dlsym() to search for symbols in the program and
libraries loaded with it. Furthermore, any running loadfile object_pathname 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.
In the following discussion, the loadfiles loaded prior to a dlopen() call are called the
prior operating load set. The prior operating load set includes the main program and its
initially loaded DLLs as well as any DLLs that were previously loaded dynamically. The
DLL named in a dlopen() is called the targeted DLL. That DLL and the libraries
loaded with it compose the added load set. The prior operating load set and the added
load set compose the new operating load set.
Resolving the Added Load Set’s Imported Symbols
The loader resolves symbols imported by the DLLs in the added load set following the
normal import-control rules for each such DLL and treating each as part of the new
operating load set. For example, the loader binds symbols imported by an added
localized DLL to those offered from its own load set, as described in The SearchList for
a Localized Loadfile on page 4-5; whereas, the loader binds symbols imported by an
added globalized DLL to those offered by the entire new operating load set. To resolve
globalized symbols, the added load set’s search list is appended to the end of the old
operating load set’s globalized search list, which is described in The SearchList for a
Globalized Loadfile on page 4-8. dlopen() can issue either warnings or errors as a
result of unresolved symbols, as described in Unresolved Symbols at Load Time on
page 2-19.
The old operating load set cannot have symbol references that must be bound to
symbol definitions in the added load set, because these would have caused errors
when the old operating load set was loaded. Instead, the old operating load set can
have pointers to procedures and data that are initially unused. Then after dlopen()
loads the added load set, the old operating load set can call dlsym to fill in the pointers,
as described in Accessing Symbols (dlsym)
on page 3-5.
dlopen’s Mode Parameter Values
dlopen() accepts any valid combination of the mode options described below.
These values are defined in the header file dlfcn.h. A mode value of zero is invalid. The
options are as follows:
RTLD_NOW
This option performs all linking on the newly loaded library immediately.










