Kenwood HP 9000 Personal Computer User Manual


 
Chapter 6 213
Shared Library Management Routines
Initializers for Shared Libraries
HP-UX 10.X style initializers are called in forward order of the +I
options specified on the link line when loading a shared library. They
are then called in reverse order when unloading the library.
HP-UX 10.X style initializers are called after inits and before finis.
Any inits or finis in archive (.a) files are called only if the .o which
contains it is used during the link. Use the linker -v option to
determine which .o files within an archive file were used.
Shared libraries on the link line (dependent libraries) follow the
ordering described in “Ordering Among Executables and Shared
Libraries”.
For example, the linker command:
$ ld -b first_64bit.o -l:libfoo.sl second_64bit.o my_64bit.a +I
first_10x_init +I second_10x_init -o libbar.sl
results in the following order when library is loaded:
1. inits from any .o files used in my_64bit.a
2. inits in second_64bit.o
3. inits in first_64bit.o
4. first_10x_init
5. second_10x_init
and the following order when library is unloaded:
1. second_10x_init
2. first_10x_init
3. finis in first_64bit.o
4. finis in second_64bit.o
5. finis from any .o files used in my_64bit.a
NOTE libfoo.sl is ignored in this example. It follows the rules in “Ordering
Among Executables and Shared Libraries”.
Ordering Among Executables and Shared Libraries
When multiple load modules have initializers/terminators, the following
rules apply to ordering: