dlopen_ia.3c (2010 09)
d
dlopen_ia(3C) dlopen_ia(3C)
(Integrity Systems Only)
NAME
dlopen_ia: dlopen(), dlopene() - open a shared library on Integrity systems
SYNOPSIS
Command:
cc [flag]... cfile...
-ldl [library ]...
#include <dlfcn.h>
void *dlopen(const char *file, int mode);
void *dlopene(const char *file, int mode, struct dlopen_opts *opts);
Remarks
This manpage describes dlopen() on Integrity systems. For
dlopen() on HP 9000 systems, see
dlopen_pa (3C).
Multithread Usage
These routines are thread-safe.
Note: The dynamic loader
dld.so serializes the loading and unloading of shared libraries in
multithreaded applications using a recursive pthread mutex lock. See the HP-UX Linker and
Libraries Online User Guide for more information.
DESCRIPTION
dlopen() and dlopene() are members of a family of routines that give the user direct access to the
dynamic linking facilities (using the -ldl option on the compiler or ld command line).
dlopen() makes a shared object specified by a file available to a running process. A shared object may
specify other objects that it "needs" in order to execute properly. These dependencies are specified by
DT_NEEDED entries in the .dynamic section of the original object. Each needed object may, in turn,
specify other needed objects. All such objects are loaded along with the original object as a result of the
call to dlopen().
dlopene() is an extension to dlopen() which allows the caller to specify explicitly the placement of a
shared library’s text and data segment when the library is dynamically loaded.
A successful
dlopen() or dlopene() call returns to the process a handle which the process may use
on subsequent calls to dlsym() and dlclose(). This value should not be interpreted in any way by
the process.
file is used to construct a path name to the object file. If file contains a slash character, the file argument
itself is used as the path name. Otherwise
dlopen() searches a series of directories, in the following
order, for file :
• Any directories specified by the dynamic path set by calling
dlsetlibpath()
.
• Any directories specified by the environment variable
LD_LIBRARY_PATH
.
• Any directories specified by
SHLIB_PATH.
• Any directories specified by a
DT_RPATH entry in the .dynamic section of the original program
object.
• The directories
/usr/lib/hpux32 in 32-bit mode and /usr/lib/hpux64
in 64-bit mode.
• The current working directory.
If the value of file is
0, dlopen() provides a handle on a "global symbol object". This object provides
access to the symbols from an ordered set of objects consisting of the original a.out, all of the objects
that were loaded at program startup along with the a.out, and all objects loaded using a dlopen()
operation along with the RTLD_GLOBAL flag. As the latter set of objects can change during execution,
the set identified by handle can also change dynamically.
Only a single copy of an object file is brought into the address space, even if
dlopen() is invoked multi-
ple times in reference to the file, and even if different path names are used to reference the file.
When a shared object is brought into the address space of a process, it may contain references to symbols
whose addresses are not known until the object is loaded. These references must be relocated before the
symbols can be accessed. The mode parameter governs when these relocations take place and may have
the following values:
HP-UX 11i Version 3: September 2010 − 1 − Hewlett-Packard Company 1