HP-UX Reference (11i v2 03/08) - 3 Library Functions N-Z (vol 7)

s
shl_load(3X) shl_load(3X)
shl_gethandle()
.
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 compatibility
mode 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)).
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(). 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) and uses static TLS model should not be used as a dependency. See "Thread
Local Storage" in dld.so(5) for more information. If a dependent library contains TLS, was built with
static TLS model and it is not loaded during program startup (that is, not linked against the executable),
the dynamic loader fails to perform the operation. You can use
+tls=dynamic compiler option to re-
compile the library to avoid errors.
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 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.so(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
Section 3954 Hewlett-Packard Company 5 HP-UX 11i Version 2: August 2003