HP aC++/HP C A.06.25 Programmer's Guide
detects unresolved symbols at startup time, rather than during program execution.
Immediate binding provides better interactive performance, but the program startup
time is longer. To force immediate binding, use the option -Wl,-B,immediate.
Example:
aCC -Wl,-B,immediate draw_shapes.o -lshape
To specify default binding, use the -Wl,B,deferred option.
For more information, refer to the HP-UX Online Linker and Libraries User’s Guide.
Side Effects of C++ Shared Libraries
When you use a C++ shared library, all constructors and destructors of nonlocal static
objects in the library are executed. This differs from a C++ archive library where only
the constructors and destructors that are actually used in the application are executed.
Routines and Options to Manage C++ Shared Libraries
You can call any of several routines to explicitly load and unload shared libraries, and
to obtain information about shared libraries.
If an error occurs when calling shared library management routines, the system error
variable, errno, is set to an appropriate error value. Constants are defined for these
error values in /usr/include/errno.h. When a program checks for these values,
it must include errno.h:
#include <errno.h>
Linker Options to Manage Shared Libraries
Use the linker options to specify shared library binding time, symbol export, and other
shared library management features.
NOTE: You must use the -Wx,args compiler option to specify any linker option on
the compiler command line.
Refer to HP-UX Online Linker and Libraries User’s Guide for more information about
library management routines and linker options.
Version Control for Shared Libraries
You can create different versions of a routine in a shared library with the
HP_SHLIB_VERSION pragma. HP_SHLIB_VERSION assigns a version number to a
module in a shared library. The version number applies to all global symbols defined
in the source file. Use this pragma only if incompatible changes are made to a source
file. Refer to HP-UX Online Linker and Libraries User’s Guide for more information about
version control in shared libraries.
240 Tools and Libraries