Linker and Libraries Guide

Building a Shared Object

The following example combines the above points:


$ cc -c -o foo.o -Kpic foo.c
$ cc -M mapfile -G -o libfoo.so.1 -z text -z defs \
-z combreloc -z ignore -R /home/lib foo.o -L. -lbar -lc

The following example combines the above points:


$ cc -M mapfile -G -o libfoo.so.1 -z text -z defs \
-zcombreloc -z ignore -R /home/lib-h libfoo.so.1 foo.o -lc
$ ln -s libfoo.so.1 libfoo.so