Kenwood HP 9000 Personal Computer User Manual


 
180 Chapter 5
Creating and Using Libraries
Using Shared Libraries in 64-bit mode
At link time, there is an outstanding unsatisfied symbol for afunc()
when libB is found. The exported symbol for afunc() is not
remembered after libA.sl is scanned. At run time, the afunc() symbol
that is called is the one that came from the archive library, which resides
in test1.
The 64-bit mode linker toolset produces:
$ test1
in SHARED library procedure `afunc'
The 64-bit mode linker remembers the symbol for afunc(), and
archive.o will not be pulled out of libB.a. The shared library version
of afunc is called during execution. This behavior is consistent with
other SVR4 systems.
Resolution of Unsatisfied Shared Library References
In the 64-bit mode linker toolset, the dynamic loader requires that all
symbols referenced by all loaded libraries be satisfied at the appropriate
time. This is consistent with other SVR4 systems.
The 32-bit mode linker toolset accepts unresolved symbols in some cases.
For example, if an entry point defined in an object file is never reachable
from the main program file, the unresolved symbol is allowed. You can
use the +vshlibunsats linker option to find unresolved symbols in
shared libraries.
For example, given these source files:
lib1.c
void a()
{
}
lib2.c
extern int unsat;
void b()
{
unsat = 14;
}
main.c
main()
{
a();
}