166 Chapter 5
Creating and Using Libraries
Caution When Mixing Shared and Archive Libraries
Figure 5-10
Compile the new f3() and rebuild the shared library lib3.sl:
$ cc -c +z f3.c Compile to relocatable code
.$ ld -b -o lib3.sl f3.o Create a new shared library.
Figure 5-11
Problem
Here's where the problem can occur. If you do not relink the application,
main.o, and just run a.out with the new version of lib3.sl, the
program will abort since f2() is not available in the application. The
reference to f2() from f3() remains unsatisfied, producing an error in
32-bit mode: