STATIC LIBRARY (.a)
+ Compile
$ gcc -Wall -c *.c+ Create library
$ ar -cvq libtest *.o+ List files in library
$ ar -t libtest.a+ Linking with library
$ gcc -o executable-name prog.c libtest.a $ gcc -o executable-name prog.c -L/path/to/library-dir -ltest
Shared Object: DYNAMICALLY LINKED LIBRARY
+ Compile object
$ gcc -Wall -fPIC -c *.c+ Create shared object
$ gcc -shared -Wl,-soname,libtest.so.1 -o libtest.so.1.0 -o *.o+ Move library to destination
$ mv libtest.so.1.0 /path/to/lib-dir+ Allow naming convention like -ltest
$ ln -sf /path/to/lib-dir/libtest.so.1.0 /path/to/lib-dir/libtest.so+ Allow run-time binding to work
$ ln -sf /path/to/lib-dir/libtest.so.1.0 /path/to/lib-dir/libtest.so.1+ Testing executable file dependencies
$ ldd executable-file
Reference: Yo-Linux