Kenwood HP 9000 Personal Computer User Manual


 
184 Chapter 5
Creating and Using Libraries
Using Shared Libraries in 64-bit mode
1. First, the dependent shared libraries for libA are built. (Other
libraries are also built.)
ld -b libD.o -o libD.sl libA dependent shared library
ld -b libE.o -o libE.sl libA dependent shared library
ld -b libF.o -o libF.sl libA dependent shared library
ld -b libB.o -o libB.sl
ld -b libC.o -o libC.sl
2. Next, libA.o is linked to its dependent libraries and libA.sl is
built.
ld -b libA.o -lD -lE -lF -o libA.sl
3. Finally, main.o is linked to its shared libraries.
cc main.o -lA -lB -lC -o main
In the 32-bit mode linker toolset, if a procedure called same_name() is
defined in libD.sl and libB.sl, main calls the procedure defined in
libD.sl. In 64-bit linker toolset, main calls same_name() in libB.sl.
If you use mixed mode shared libraries, the search mechanism may
produce unexpected results.
For the following command, libA.sl and its dependent libB.sl are
compatibility mode libraries and libC.sl and libD.sl are standard
mode libraries.
ld -b libF.o +compat -L.-lA -lC -o LibF.sl
libF.sl is a compatibility mode library, but is dependent libC.sl is a
standard mode library. The linker uses depth-first searching
mechanisms because the highest-level library is in compatability mode.
Mixed Mode Shared Libraries
A mixed mode shared library is a library whose children are all of one
type (for example, +compat), but whose grandchildren may be of the
other mode. This poses some problems when linking and loading the
libraries. To help resolve this, the linker treats each library as having
any mode. Therefore, when it sees a compatibility mode library, it
searches for it using the 32-bit-style algorithms. For any standard mode
library, it uses the 64-bit-style algorithms.Only the load order of the
libraries themselves is fixed between depth-first or breadth-first.