Kenwood HP 9000 Personal Computer User Manual


 
Chapter 6 203
Shared Library Management Routines
Initializers for Shared Libraries
The ld command supports the +fini option to specify theterminator.
32-bit Mode Initializers
The 32-bit mode linker supports HP-UX 10.X style initializers.
This section contains the following topics:
Using HP-UX 10.X Style Initializers
“Declaring the Initializer with the +I Option”
“Initializer Syntax”
“Example: An Initializer for Each Library”
“Example: A Common Initializer for Multiple Libraries”
Using HP-UX 10.X Style Initializers
The initializer is called for libraries that are loaded implicitly at program
startup, or explicitly with shl_load.
When calling initializers for implicitly loaded libraries, the dynamic
loader waits until all libraries have been loaded before calling the
initializers. It calls the initializers in depth-first order—that is, the
initializers are called in the reverse order in which the libraries are
searched for symbols. All initializers are called before the main program
begins execution.
When calling the initializer for explicitly loaded libraries, the dynamic
loader waits until any dependent libraries are loaded before calling the
initializers. As with implicitly loaded libraries, initializers are called in
depth-first order.
Note that initializers can be disabled for explicitly loaded libraries with
the BIND_NOSTART flag to shl_load. For more information, see “The
shl_load and cxxshl_load Routines”.
Declaring the Initializer with the +I Option
To declare the name of the initializer, use the +I linker option when
creating the shared library. The syntax of the +I option is:
+I initializer
where initializer is the initializer's name.
Multiple initializers may be called by repeating the +I initializer option.