We can create a shared library using standard naming conventions as follows:
$ gcc -fPIC -g -c -Wall mod1.c mod2.c mod3.c $ gcc -shared -Wl,-soname,libdemo.so.1 -o libdemo.so.1.0.1 \ mod1.o mod2.o mod3.o
$ ln -s libdemo.so.1.0.1 libdemo.so.1 $ ln -s libdemo.so.1 libdemo.so $ ls -l libdemo.so* | cut -c 1-11,55- # Verify the setup lrwxrwxrwx libdemo.so -> libdemo.so.1 lrwxrwxrwx libdemo.so.1 -> libdemo.so.1.0.1 -rwxr-xr-x libdemo.so.1.0.1
$ gcc -g -Wall -o ./prog prog.c -L. -ldemo
$ LD_LIBRARY_PATH=. ./prog Called mod1-x1 Called mod2-x2
(C) 2006, Michael Kerrisk