192 Chapter 5
Creating and Using Libraries
Using Shared Libraries in 64-bit mode
3. ./libbar.sl (./libbar.sl) found
4. LD_LIBRARY_PATH to find libme.sl not found
5. SHLIB_PATH to find libme.sl not found
6. /var/tmp/libme.sl found
7. LD_LIBRARY_PATH to find libc.sl not found
8. SHLIB_PATH to find libc.sl not found
9. ./libc.sl not found
10./usr/lib/pa20_64/libc.sl found
Library Example: Linking to Libraries with +b path_list in
32-bit Mode.
This example is the same as “Library Example: Linking
to Libraries with +b path_list in 64-bit Mode”, but this time the program
is compiled in 32-bit mode.
cc -c +DD32 me.c
ld -b me.o -o libme.sl
ld -b bar.o -o libbar.sl -L. -lme +b /var/tmp
ld main.o -L. -lbar -lc
mv libme.sl /var/tmp
When linking main.o, the link order is:
1. ./libbar.sl found
2. ./libme.sl found
3. ./libc.sl not found
4. /usr/lib/libc.sl found
In the above example, if you type:
mv libme.sl /var/tmp
ld main.o -L. -lbar -lc
instead of:
ld main.o -L. -lbar -lc
mv libme.sl /var/tmp
the linker issues the following error:
ld: Can’t find dependent library ./libme.sl
Fatal Error