HP aC++/HP C A.06.25 Programmer's Guide

For example, when a module in an existing shared library requires a fix, recompile the
fixed module with the +z or +Z option, and recreate the shared library with the -b
option.
Programs that use this library will now use the new versions of the routines. You do
not have to relink programs that use this shared library because they are attached at
run time.
Advanced Shared Library Features
This section explains additional things you can perform with shared libraries. It discusses
the following topics:
Forcing the Export of Symbols in main
Binding Times
Side Effects of C++ Shared Libraries
Routines and Options to Manage C++ Shared Libraries
Version Control for Shared Libraries
Adding New Versions to a Shared Library
Forcing the Export of Symbols in main
By default, the linker exports from a program only those symbols that were imported
by a shared library. For example, if shared libraries of an executable does not reference
the main routine of the program, the linker does not include the main symbol in the
export list of a.out.
Normally, this is a problem only when a program explicitly calls shared library
management routines. (See “Routines and Options to Manage C++ Shared Libraries”
(page 240).)
To make the linker export all symbols from a program, use the -Wl,-E option, which
passes the -E option to the linker.
Binding Times
Because shared library routines and data are not actually contained in the a.out file,
the dynamic loader must attach the routines and data to the program at run time. To
accelerate program startup time, routines in a shared library are not bound until
referenced. (Data items are always bound at program startup.) This deferred binding
distributes binding overhead across the total execution time of the program and is
especially helpful for programs that contain many references that are not likely to be
executed.
Forcing Immediate Binding
You can force immediate binding, that forces all routines and data to be bound at
startup time. With immediate binding, the overhead of binding occurs only at program
startup time, rather than across the execution of the program. Immediate binding also
Creating and Using Libraries 239