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)
DIAGNOSTICS
If a library cannot be loaded, shl_load() returns NULL and sets
errno to indicate the error. This
includes trying to
shl_load() a library containing thread local storage. All other functions return −1on
error and set
errno.
If shl_findsym()
cannot find the indicated symbol, errno is set to zero. On PA-RISC 32-bit systems
only, if
shl_findsym()
finds the indicated symbol but cannot resolve all the symbols it depends on,
errno is set to ENOSYM.
ERRORS
Possible values for
errno include:
[ENOEXEC] The specified file is not a shared library, or a format error was detected.
[ENOSYM] Some symbol required by the shared library could not be found.
[EINVAL] The specified handle or index is not valid or an attempt was made to load a library at
an invalid address.
[ENOMEM] There is insufficient room in the address space to load the library.
[ENOENT] The specified path does not exist, or the specified handle is invalid.
[ETXTBSY] The specified shared library is currently in use and cannot be unloaded.
[EACCES] Read or execute permission is denied for the specified library.
WARNINGS
shl_unload() detaches the library from the process and frees the memory allocated for it, but does not
break existing symbolic linkages into the library. In this respect, an unloaded shared library is much like a
block of memory deallocated via free() (see malloc(3C)).
On PA-RISC 32-bit systems, shl_unload() unloads the shared library regardless of whether there are
other references to it. On PA-RISC 64-bit systems, a reference count is kept for each loaded library, and
shl_unload() does not remove the shared library until all references are removed.
Some implementations may not, by default, export all symbols defined by a program (instead exporting only
those symbols that are imported by a shared library seen at link time). Therefore the -E
option to ld(1)
should be used when using these routines if the loaded libraries are to refer to program symbols.
All symbol information returned by
shl_getsymbols()
, including the name field, become invalid once
the associated library is unloaded by
shl_unload() . On PA-RISC 64-bit systems, this is also true if a
library is unloaded by a call to dlclose().
Use caution when building shared libraries with external library dependencies. Any library that contains
Thread Local Storage (TLS) should not be used as a dependency. If a dependent library contains TLS, and
it is not loaded during program startup (that is, not linked against the executable), the dynamic loader fails
to perform the operation.
When a routine or flag is used which may not be supported in the future, the dynamic loader can display a
warning message. See the WARNINGS section in dld.sl(5) for further details.
Future HP-UX 64-bit environments may not support these routines and flags or may only support a subset
of them. Instead, they will use the SVR4 dynamic loading API. Users are encouraged to migrate to the
dl* family of dynamic linking routines. See the dlclose(3C), dlerror(3C), dlget(3C), dlgetname(3C),
dlmodinfo(3C), dlopen(3C), and dlsym(3C) man pages for more information.
AUTHOR
shl_load(3X) and related functions were developed by HP.
SEE ALSO
System Tools
ld(1) invoke the link editor
Miscellaneous
dld.sl(5) dynamic loader
dlclose(3C) unload a shared library previously loaded by dlopen()
dlerror(3C) print the last error message recorded by dld
412 Hewlett-Packard Company − 5 − HP-UX 11i Version 3: February 2007