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 \
-R /home/lib foo.o -L. -lbar

The following example combines the above points:


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