Kenwood HP 9000 Personal Computer User Manual


 
Chapter 5 189
Creating and Using Libraries
Using Shared Libraries in 64-bit mode
Library Example: Using 64-bit Mode Compatibility
and Standard Shared Libraries
This example mixes compatibility and standard mode shared libraries. It
uses 32-it-style linking and loading for the compatibility mode libraries
and 64-bit-style linking and loading for standard mode libraries.
# build standard mode dlls
# libfile1.sl is a dependent of libfile2
ld -b file1.o -o libfile1.sl +h libfile1.1
mkdir TMP
ld -b +b $pwd/TMP file2.o -o libfile2.sl +h libfile2.1 -L. -lfile1
# build compatibility mode dlls
# libfile3.sl is a dependent of libfile4
ld -b file3.o -o libfile3.sl +h libfile3.1
ld -b file4.o -o libfile4.sl +b $pwd/TMP +h libfile4.1 +compat -L.
-lfile3
ln -s libfile1.sl libfile1.1
ln -s libfile3.sl libfile3.1
mv libfile1.sl TMP
mv libfile3.sl TMP
cd TMP
ln -s libfile1.sl libfile1.1
ln -s libfile3.sl libfile3.1
cd ..
# link with +b so ld will use RPATH at link time to find
# libfile1.sl (standard mode dll)
# the linker will not use RPATH to find libfile3.sl
# (compatibility mode dll)
# Note that this is true in both a standard mode link and a
# compatibility mode link. The
# linker never uses RPATH to find any compatibility mode dlls
ld -b +b pwd/TMP main.o -o libfile5.sl +h libfile5.1 -L. -lfile2
-lfile4
ld: Can’t find dependent library “./libfile3.sl”
ld -b +b pwd/TMP main.o -o libfile5a.sl +h libfile5.1 -L. -lfile2
-lfile4 +compat
ld: Can’t find dependent library “./libfile3.sl”
Comparing Breadth-first and Depth-first Search in
64-bit Mode
For the following libraries, with the dependencies:
lib1.sl has dependents lib2.sl, lib3.sl, and lib4.sl
lib2.sl has dependents lib2a.sl and lib2b.sl
lib3.sl has dependents lib3a.sl and lib3b.sl
lib3a.sl has dependent lib3aa.sl