230 Chapter 6
Shared Library Management Routines
The shl_load Shared Library Management Routines
The shl_gethandle and shl_gethandle_r
Routines
Returns descriptor information about a loaded shared library.
Syntax
int shl_gethandle( shl_t handle,
struct shl_descriptor **desc )
Parameters
handle The handle of the shared library you want information
about. This handle is the same as that returned by
shl_load.
desc Points to shared library descriptor information — the
same information returned by the shl_get routine.
The buffer used to store this desc information is static,
meaning that subsequent calls to shl_gethandle will
overwrite the same area with new data. Therefore, if
you need to save the desc information, copy it
elsewhere before calling shl_gethandle again.
Return Value
If handle is not valid, the routine returns −1 and sets errno to EINVAL.
Otherwise, shl_gethandle returns 0.
Description
The shl_gethandle routine returns descriptor information about a
loaded shared library. If you are programming in a threaded
environment, use the thread-safe version shl_gethandle_r which is
the same as shl_gethandle in all other respects. (See Programming
with Threads on HP-UX for more information about threads.)
Example
The following function named show_lib_info displays information
about a shared library, given the library's handle.
show_lib_info — Display Information for a Shared Library
#include <stdio.h>
#include <dl.h>