Chapter 6 217
Shared Library Management Routines
The shl_load Shared Library Management Routines
Causes the dependent libraries to be loaded breadth
first. By default, the 64-bit mode shl_load loads
dependent libraries depth-first.
These flags are discussed in detail in“shl_load
Example”.
address Specifies the virtual address at which to attach the
library. Set this parameter to 0 (zero) to tell the system
to choose the best location. This argument is currently
ignored; mapping a library at a user-defined address is
not currently supported.
Return Value
If successful, shl_load returns a shared library handle of type
shl_t. This address can be used in subsequent calls to shl_close,
shl_findsym, shl_gethandle, and shl_gethandle_r. Otherwise,
shl_load returns a shared library handle of NULL and sets errno to one
of these error codes (from <errno.h>):
ENOEXEC The specified path is not a shared library, or a format
error was detected in this or another library.
ENOSYM A symbol needed by this library or another library
which this library depends on could not be found.
ENOMEM There is insufficient room in the address space to load
the shared library.
EINVAL The requested shared library address was invalid.
ENOENT The specified path does not exist.
EACCESS Read or execute permission is denied for the specified
path.
Description
A program needs to explicitly load a library only if the library was not
linked with the program. This typically occurs only when the library
cannot be known at link time — for example, when writing programs
that must support future graphics devices.