Chapter 6 227
Shared Library Management Routines
The shl_load Shared Library Management Routines
Syntax
int shl_get( int index,
struct shl_descriptor **desc )
Parameters
index Specifies an ordinal number of the shared library in the
process. For libraries loaded implicitly (at startup
time), index is the ordinal number of the library as it
appeared on the command line. For example, if libc
was the first library specified on the ld command line,
then libc has an index of 1. For explicitly loaded
libraries, index corresponds to the order in which the
libraries were loaded, starting after the ordinal
number of the last implicitly loaded library. Two index
values have special meaning:
0 Refers to the main program itself
−1 Refers to the dynamic loader
(dld.sl).
A shared library's index can be modified during
program execution by either of the following events:
• The program loads a shared library with the
BIND_FIRST modifier to shl_load. This
increments all the shared library indexes by one.
• The program unloads a shared library with
shl_unload. Any libraries following the unloaded
library have their index decremented by one.
desc Returns a pointer to a statically allocated buffer
(struct shl_descriptor **) containing a shared
library descriptor. The structure contains these
important fields:
tstart The start address (unsigned long)
of the shared library text segment.
tend The end address (unsigned long) of
the shared library text segment.
dstart The start address (unsigned long)
of the shared library data segment.