HP-UX Linker and Libraries User's Guide
7 Shared Library Management Routines
You can explicitly load and use shared libraries from your program. The linker toolset provides
two families of load routines, dlopen and shl_load. The dlopen routines (primarily for IPF/PA-64
mode ) use Unix SVR4 compatible mechanism for library management. The shl_load routines
support the shared library mechanisms provided in previous versions of HP-UX.
NOTE: Support for shl_load library management routines may be discontinued in a future
IPF/PA-64 HP-UX release. You are encouraged to migrate to the dlopen family of routines for
shared library management if you use the IPF/PA-64 mode linker toolset.
Do not mix use of the shl_load and dlopen APIs.
Shared Library Management Routine Summaries
The following sections introduce the shared library management routines.
The dlopen Routines Summary
The dlopen family of shared library management routines is available for the IPF and PA-64 linker.
The following routines are also supported by the PA-32 linker:
• dlopen
• dlclose
• dlsym
• dlerror
• dladdr
The dlopen family of routines use Unix SVR4 shared library mechanisms.
Use the following dl* routines for shared library management:
Table 22 dl* routines for shared library management
ActionRoutine
Loads a shared library. This routine does breadth-first
searching.
“The dlopen Shared Library Management Routines”
(page 148)
Extension of dlopen allowing specific placement of text.“Description” (page 150)
Sets the dynamic search path to locate shared libraries.“The dlsetlibpath Routine” (page 153)
Returns numeric error code corresponding to last error that
occurred during dynamic linking processing.
“The dlerrno Routine” (page 155)
Returns file information for a library prior to loading it.“The dlgetfileinfo Routine” (page 155)
Prints the last error message recorded by dld.“The dlerror Routine” (page 157)
Gets the address of a symbol in a shared library.“The dlsym Routine” (page 157)
Returns information on a loaded module.“The dlget Routine” (page 159)
Returns information about a loaded module.“The dlmodinfo Routine” (page 160)
Retrieves the name of a loaded module, given a load model
descriptor.
“The dlgetname Routine” (page 161)
Unloads a shared library previously loaded by dlopen().“The dlclose Routine” (page 162)
Gets the symbolic information for an address.“The dladdr Routine” (page 163)
Registers information about dynamically generated functions.“The dlmodadd Routine” (page 165)
136 Shared Library Management Routines