Kenwood HP 9000 Personal Computer User Manual


 
178 Chapter 5
Creating and Using Libraries
Using Shared Libraries in 64-bit mode
LD_LIBRARY_PATH and the SHLIB_PATH environment variable to add
directories to the run time search path for shared libraries, unless the ld
+noenvvar option is set.
In the 32-bit mode of the linker toolset (selected by the +compat option),
the linker enables run-time dynamic path searching when you link a
program with the -llibrary and +b path_name options. Or, you can use
the -llibrary option with the +s path_name option. When programs are
linked with +s, the dynamic loader searches directories specified by the
SHLIB_PATH environment variable to find shared libraries.
The following example shows dynamic path searching changes for 64-bit
mode.
ld /opt/langtools/lib/crt0.o main.o \ Subject to
-lfoo -o main dynamic path searching.
In 32-bit mode, main aborts at run time if libfoo.sl is moved from its
standard location, /usr/lib or /usr/ccs/lib. The linker does not do
dynamic path searching unless you specify the +b or +s options to the ld
or chatr commands. In 64-bit mode, the dynamic loader searches for
libfoo.sl in the directories specified by the LD_LIBRARY_PATH and
SHLIB_PATH environment variables.
Shared Library Symbol Binding Semantics
Symbol binding resolution, both at link time and run time, changes
slightly in the 64-bit mode HP-UX linker toolset. The symbol binding
policy is more compatible with other open systems.
This section covers the following topics:
Link-time symbol resolution in shared libraries
Resolution of unsatisfied shared library references
Promotion of uninitialized global variables
Symbol searching in dependent libraries
Link-Time Symbol Resolution in Shared Libraries
In the 64-bit mode of the linker toolset, the linker remembers all symbols
in a shared library for the duration of the link. Global definitions satisfy
trailing references, and unsatisfied symbols remaining in shared
libraries are reported.