Kenwood HP 9000 Personal Computer User Manual


 
Chapter 6 243
Shared Library Management Routines
The dlopen Shared Library Management Routines
To determine the scope of visibility for the symbols loaded with a dlopen
invocation, bitwise OR the mode parameter with one of the following
values: RTLD_GLOBAL or RTLD_LOCAL.
If neither RTLD_GLOBAL nor RTLD_LOCAL are specified, the default is
RTLD_LOCAL.
If a file is specified in multiple dlopen invocations, mode is interpreted
at each invocation. Note, however, that once RTLD_NOW has been
specified, the linker operation completes all relocations, rendering any
further RTLD_NOW operations redundant and any further RTLD_LAZY
operations irrelevant. Similarly note that once you specify
RTLD_GLOBAL, the shared library maintains the RTLD_GLOBAL status
regardless of any previous or future specification of RTLD_LOCAL, as long
as the shared library remains in the address space [see dlclose(3C)].
Symbols introduced into a program through calls to dlopen may be used
in relocation activities. Symbols so introduced may duplicate symbols
already defined by the program or previous dlopen operations. To
resolve the ambiguities such a situation might present, the resolution of
a symbol reference to a symbol definition is based on a symbol resolution
order. Two such resolution orders are defined: load and dependency
ordering.
Load order establishes an ordering among symbol definitions using
the temporal order in which the shared libraries containing the
definitions were loaded, such that the definition first loaded has
priority over definitions added later. Load ordering is used in
relocation processing.
Dependency ordering uses a “breadth-first” order starting with a
given shared library, then all of its dependencies, then any
dependents of those, iterating until all dependencies are satisfied.
The dlsym function uses dependency ordering, except when the global
symbol shared library is obtained via a dlopen operation on file with a
value 0. The dlsym function uses load ordering on the global symbol
shared library.
When a dlopen operation first makes it accessible, an shared library
and its dependent shared libraries are added in dependency order. Once
all shared libraries are added, relocations are performed using load
order. Note that if an shared library and its dependencies have been
loaded by a previous dlopen invocation or on startup, the load and
dependency order may yield different resolutions.