HP-UX Reference (11i v2 03/08) - 3 Library Functions N-Z (vol 7)

s
shl_load(3X) shl_load(3X)
NAME
shl_load(), shl_definesym(), shl_findsym(), shl_gethandle(), shl_getsymbols(), shl_unload(), shl_get(),
shl_gethandle_r(), shl_get_r() - explicit load of shared libraries
SYNOPSIS
#include <dl.h>
shl_t shl_load(const char *path, int flags, long address);
int shl_findsym(
shl_t *handle,
const char *sym,
short type,
void *value
);
int shl_definesym(
const char *sym,
short type,
long value,
int flags
);
int shl_getsymbols(
shl_t handle,
short type,
int flags,
void *(*memory) (),
struct shl_symbol **symbols,
);
int shl_unload(shl_t handle);
int shl_get(int index, struct shl_descriptor **desc);
int shl_gethandle(shl_t handle, struct shl_descriptor **desc);
int shl_get_r(int index, struct shl_descriptor *desc);
int shl_gethandle_r(shl_t handle, struct shl_descriptor *desc);
MULTITHREAD USAGE
These routines are safe to be called from multithreaded applications.
DESCRIPTION
These routines can be used to programmatically load and unload shared libraries, and to obtain informa-
tion about the libraries (such as the addresses of symbols defined within them). The routines themselves
are accessed by specifying the
-ldld option on the command line with the ld command (see ld(1)).
See WARNINGS. In addition, the -E option to the ld command can be used to ensure that all symbols
defined in the program are available to the loaded libraries.
Shared libraries are created by compiling source files and linking the resultant object files with the
-b
(create shared library) option.
shl_load() Attaches the shared library named by path or the shared library name that is con-
structed by using the path part of path plus the shared library basename followed
by the suffix .0 (e.g. /usr/lib/hpux64/libname.0) to the process, along
with all its dependent libraries. A
.0 version is looked for first for those shared
libraries that do not have internal names. See ld(1)). The library is mapped at the
specified address.Ifaddress is 0L, the system chooses an appropriate address for
the library. This is the recommended practice because the system has the most
complete knowledge of the address space; currently, the address field is ignored,
and assumed to be 0L. If the shared library contains thread local storage and was
built with static TLS model, you cannot load it with this routine. See "Thread Local
Storage" in dld.so(5) for more information. The flags argument is made up of
several fields. One of the following must be specified:
Section 3950 Hewlett-Packard Company 1 HP-UX 11i Version 2: August 2003