Kenwood HP 9000 Personal Computer User Manual


 
190 Chapter 5
Creating and Using Libraries
Using Shared Libraries in 64-bit mode
+-->lib2a.sl
|
+-->lib2.sl-->lib2b.sl
|
lib1.sl-->lib3.sl-->lib3a.sl-->lib3aa.sl
||
| +-->lib3b.sl
+-->lib4.sl
In breadth-first searching, the load order is siblings before children:
lib1.sl->lib2.sl->lib3.sl->lib4.sl->lib2a.sl->lib2b.sl->lib3a.sl-
>lib3b.sl->lib3aa.sl
In depth-first searching, the load order is children before siblings:
lib1.sl->lib2.sl->lib2a.sl->lib2b.sl->lib3.sl->lib3a.sl->lib3aa.s
l->lib3b.sl->lib4.sl
Library Example: Using RPATH with Standard Mode
Shared Library
In the following example, the linker uses the embedded RPATH at link
time to find the dependent library. For compatibility mode shared
libraries, embedded RPATHs are ignored.
ld -b bar.o -o libbar.sl
ld -b foo.o -o libfoo.sl -L. -lbar +b /var/tmp
# ld should look in /var/tmp to find libbar.sl since libfoo.sl
# has an embedded RPATH of
# /var/tmp
mv libbar.sl /var/tmp
ld main.o -L. -lfoo -lc
# For compatibility mode dlls, embedded RPATHs are ignored
ld -b bar.o -o libbar.sl
ld -b foo.o -o libfoo.sl +compat -L. -lbar +b /var/tmp
# ld won’t find libbar.sl since it does not look at embedded RPATHs
mv libbar.sl /var/tmp
ld main.o -L. -lfoo +compat -lc
ld: Can’t find dependent library “libbar.sl”
Fatal error.
Linking Libraries with +b pathlist
The following examples compare 32-bit and 64-bit mode linking with the
ld +b pathlist option. The dynamic loader uses the directory specified
by the -L option at link time for dynamic library lookup at run time, if
you do not use the +b option.