gcc -c -fPIC foo.c # compile gcc -shared -o Foo.so foo.o # create/link shared library Foo.so gcc -rdynamic -o mytest mytest.c -ldl # create wrapper executable which loads Foo.so