bash$ gcc -g -c -fPIC -Wall -c foo.c bash$ gcc -g -shared -o libfoo.so foo.o bash$ gcc -g -Wl,-Bsymbolic -o prog prog.c libfoo.so bash$ LD_LIBRARY_PATH=. ./prog foo-xyz
-Bsymbolic
says that references to global symbols
within a shared library should be
preferentially bound to
definitions in that library.
(C) 2006, Michael Kerrisk