So, the complete procedure for a very simple program might look like:

gcc -c -fpic test.c
gcc -shared -o libtest.so test.o
gcc -c main.c
gcc -o test main.o -L. -ltest -rpath /usr/local/test/lib
cp libtest.so /usr/local/test/lib
cp test /usr/local/test/bin
/usr/local/test/bin/test
_________________________
Bitt Faulk