Easy. First make sure the DEMO symbol in gp3lib.c is set to 0. This disables the main function.


Then issue:


gcc -fPIC -g -c gp3linux.c


gcc -fPIC -g -c gp3lib.c


gcc -shared -Wl,-soname,libgp3.so.1 -o libgp3.so.1.0.1 gp3.o gp3linux.o -lc


sudo cp libgp3.so.1.0.1 /usr/local/lib


sudo cp gp3lib.h /usr/local/include


sudo ldconfig


Then you can include in your program and pass -lgp3 to the compiler:


gcc -o testpgm testpgm.c -lgp3


Note: This is also useful if you want to use the library with JNI or JNA with Java.