dlopen_ia.3c (2010 09)
d
dlopen_ia(3C) dlopen_ia(3C)
(Integrity Systems Only)
RTLD_TEXT_PRIVATE
Under this mode, the shared library loaded has its text segment mapped private.
This can be useful for debugging.
RTLD_LAZY Under this mode, only references to data symbols are relocated when the object is
loaded. References to functions are not relocated until a given function is invoked
for the first time. This mode should result in better performance, since a process
may not reference all of the functions in any given shared object.
RTLD_NOW Under this mode, all necessary relocations are performed when the object is first
loaded. This may result in some wasted effort, if relocations are performed for func-
tions that are never referenced, but is useful for applications that need to know as
soon as an object is loaded that all symbols referenced during execution are avail-
able.
Any object loaded by
dlopen() that requires relocations against global symbols can reference the sym-
bols in the original a.out, any objects loaded at program startup, from the object itself as well as any
other object included in the same dlopen() invocation, and any objects that were loaded in any
dlo-
pen() invocation that specified the RTLD_GLOBAL
flag. To determine the scope of visibility for the sym-
bols loaded with a
dlopen() invocation, the mode parameter should be bitwise or’ed with one of the fol-
lowing values:
RTLD_GLOBAL The object’s symbols are made available for the relocation processing of any other
object. In addition, symbol lookup using dlopen(0,mode) and an associated
dlsym() allows objects loaded with RTLD_GLOBAL to be searched.
RTLD_LOCAL The object’s symbols are made available for relocation processing only to objects
loaded in the same dlopen() invocation.
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, all relocations will have been completed, rendering any
further RTLD_NOW operations redundant and any further RTLD_LAZY operations irrelevant.
Similarly, note that once
RTLD_GLOBAL has been specified, the object will maintain the RTLD_GLOBAL
status regardless of any previous or future specification of RTLD_LOCAL, so long as the object remains in
the address space (see dlclose (3C)).
To determine the scope of symbols that are made available for relocation processing of objects loaded in a
dlopen() invocation, the mode parameter can be bitwise or’ed with one of the following values:
RTLD_GROUP Under this mode, the specified object, and its dependencies, behave as if they were
built with -B group (see ld(1)). Only symbols from objects loaded in the same
dlopen() invocation are made available for relocation. This ensures that all relo-
cations are satisfied using symbol definitions from the same dlopen() invocation.
RTLD_WORLD Under this mode, only symbols from global objects and from the object itself are
available for relocation processing. It does not use symbol definitions from other
objects loaded as part of the dlopen() invocation. This flag has no effect on
objects build with -B group (see ld(1)).
RTLD_PARENT Under this mode, symbols from the object that invoked dlopen() are also made
available for relocation.
The default modes for
dlopen() are RTLD_WORLD|RTLD_GROUP. These flags are OR’ed together
when the same object is loaded with different modes.
The following flags do not affect relocation processing but provide other features:
RTLD_NODELETE Under this mode, the specified object and its dependencies behave as if they were
built with -B nodelete (see ld(1)). An explicit unload using dlclose() or
shl_load() returns success silently without detaching the shared library from
the process. Subsequently, the shared library handle is valid only for
shl_findsym(). It stays invalid for dlsym(), dlclose(), and
shl_unload() until the next explicit load using shl_load() or dlclose().
RTLD_NOLOAD Under this mode, the specified object is not loaded into the process’s address space,
but a valid handle is returned if the object already exists in the process address
space. If the specified object does not already exist, then an error is returned.
RTLD_NOLOAD can be used to query the presence, or for overriding the modes, of
2 Hewlett-Packard Company − 2 − HP-UX 11i Version 3: September 2010