TOC   Previous   Next

Run-time symbol resolution (cont.)

We see the following when we run the program:

bash$ gcc -g -c -fPIC -Wall -c foo.c
bash$ gcc -g -shared -o libfoo.so foo.o
bash$ gcc -g -o prog prog.c libfoo.so
bash$ LD_LIBRARY_PATH=. ./prog
main-xyz

The definition of xyz() in the main program interposed the definition in the shared library.

Why?

(C) 2006, Michael Kerrisk