Assuming you have a directory of source files you want to turn into a dynamic linked library, first convert them into object files using the following command:
gcc -fPIC -c *.c
The -fpic
command stands for "position independent code".
Next, the library is created using the following command: