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)
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 1
on error and set errno.
If shl_findsym() cannot find the indicated symbol, errno is set to zero. On PA32 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 library does not exist.
[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 PA32, shl_unload() unloads the shared library regardless of whether there are other references to
it. On PA64, 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 PA64, 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
dlget(3C) return information about a loaded module
dlgetname(3C) return the name of the storage containing a load module
HP-UX Release 11i: December 2000 5 Section 3855
___
___