HP-UX Reference (11i v3 07/02) - 3 Library Functions N-Z (vol 7)
s
shl_load_pa(3X)
PA-RISC Systems Only
shl_load_pa(3X)
The type field in the return structure can have the values
TYPE_PROCEDURE
,orTYPE_DATA .On
PA-RISC 32i-bit systems, you can also have the values
TYPE_STORAGE or TYPE_TSTORAGE
.
These are a subset of
TYPE_DATA. The value and handle fields are only valid if export symbols are
requested and the
NO_VALUES flag is not specified. The value field contains the address of the sym-
bol, while the handle field is the handle of the library that defined the symbol, or NULL for symbols
defined via the
shl_definesym()
routine and is useful in conjunction with the
GLOBAL_VALUES
flag.
If successful, shl_getsymbols()
returns the number of symbols found; otherwise it returns −1.
shl_unload()
Can be used to detach a shared library from the process. The handle argument should be the handle
returned from a previous call to
shl_load() . On PA-RISC 64-bit systems, you can also get the
handle from a call to dlopen(). shl_unload()
returns 0 if successful; otherwise −1 is returned.
Any initializers registered with the library are called before detachment. All explicitly loaded libraries
are detached automatically on process termination.
The same shared library can be opened multiple times. On PA-RISC 32-bit systems,
shl_unload
unloads the shared library regardless of whether there are other references to it through other load
invocations or through implicit references from other shared libraries. No reference count is kept. On
PA-RISC 64-bit systems, a reference counter is kept for each loaded shared library, like the behavior
of dlopen(3C) and dlclose(3C). shl_unload does not remove the shared library from the address
space until all references to that shared library have been removed.
shl_get()
Returns information about currently loaded libraries, including those loaded implicitly at startup time.
The index argument is the ordinal position of the shared library in the shared library search list for
the process. A subsequent call to shl_unload() or dlclose() decrements the index values of
all libraries having an index greater than the unloaded library. The index value −1 refers to the
dynamic loader and the index value −2 refers to the program file itself. The desc argument is used to
return a pointer to a statically allocated buffer containing a descriptor for the shared library. The for-
mat of the descriptor is implementation dependent; to examine its format, look at the contents of file
/usr/include/dl.h
. Information common to all implementations includes the library handle,
pathname, and the range of addresses the library occupies. The buffer for the descriptor used by
shl_get() is static; the contents should be copied elsewhere before a subsequent call to the routine.
The routine returns 0 normally, or −1 if an invalid index is given.
shl_gethandle()
Returns information about the library specified by the handle argument. The special handle
PROG_HANDLE can be used to refer to the program itself. The descriptor returned is the same as the
one returned by the shl_get() routine. The buffer for the descriptor used by
shl_gethandle() is static; the contents should be copied elsewhere before a subsequent call to
the routine. The routine returns 0 normally, or −1 on error.
shl_get_r()
This is a reentrant version of shl_get(). The desc argument must point to a buffer of enough
user-defined storage to be filled with the library descriptor described in /usr/include/dl.h
. Its
semantics are otherwise identical to
shl_get().
shl_gethandle_r()
This is a reentrant version of shl_gethandle(). The desc argument must point to a buffer of
enough user-defined storage to be filled with the library descriptor described in
/usr/include/dl.h. Its semantics are otherwise identical to shl_gethandle()
.
dld_getenv()
Informs the dynamic loader that the environment variable SHLIB_PATH has been modified since
program startup and the new value should be used for subsequent calls to shl_load().
MULTITHREAD USAGE
These routines are safe to be called from multithreaded applications.
Note: The 32-bit dynamic loader dld.sl serializes the loading and unloading of shared libraries in mul-
tithreaded applications using a pthread mutex lock. See the HP-UX Linker and Libraries Online User
Guide for more information.
HP-UX 11i Version 3: February 2007 − 4 − Hewlett-Packard Company 411