214 Chapter 6
Shared Library Management Routines
Initializers for Shared Libraries
• When loading, the inits and HP-UX 10.X initializers of any dependent
libraries are called before the ones in the current library.
• When unloading, the finis and HP-UX 10.X initializers of any
dependent libraries are called after the finis of the current library.
• If a shared library is itself a dependent of one of its dependents (a
“circular” dependency), no ordering between them is guaranteed.
For example, given three libraries: libA.sl, libB.sl, libC.sl. If
libA.sl were linked as (libB.sl and libC.sl are “dependent”
libraries of libA.sl):
$ ld -b foo.o -lB -lC -o libA.sl
One possible ordering while loading is:
• inits in C
• inits in B
• inits in A
and while unloading is:
• finis inA
• finis in B
• finis in C