HP-UX Reference (11i v1 00/12) - 3 Library Functions N-Z (vol 7)
__________________________________________________________________________________________________________________________________________________________________________________________________
__________________________________________________________________________________________________________________________________________________________________________________________________
STANDARD Printed by: Nora Chuang [nchuang] STANDARD
/build/1111/BRICK/man3/nan.3m
________________________________________________________________
___ ___
s
shl_load(3X) shl_load(3X)
struct shl_symbol {
char *name,
short type,
void *value,
shl_t handle,
};
The type field in the return structure can have the values TYPE_PROCEDURE,or
TYPE_DATA. On PA32, 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 symbol, 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; other-
wise 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 PA64, 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 PA32, 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 PA64, 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. The desc
argument is used to return a pointer to a statically allocated buffer containing a
descriptor for the shared library. The format 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 else-
where before a subsequent call to the routine. The routine returns 0 normally, or −1if
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().
Section 3−−854 − 4 − HP-UX Release 11i: December 2000
___
___