The files with extension .c is compiled, the compiler generate the object code, after generating the object code, the compiler also invokes linker. The task of linker is to make code of library function (printf( ), scanf( ), sqr( )), that exist in your program.
Static libraries: Its libraries is reusable in multiple programs, locked into a program compile time unlike Dynamic libraries exist as separates files outside of the executable file.
Created dynamic libraries
The files .c need to be prepared for use in dynamic library, this library don’t store data at fixed address is because the location of the library in memory is different between programs, using the flag -fpic and the flag -c just ensures that each files .o isn’t linked yet
The object files are now ready to be compiled into a dynamic library, its compiling * all of the .o files, which is specified using the flag -shared. The name for convention for dynamic libraries start with lib and end .so.
Finally export the path for libraries so that programs know where to look for them by executing the command export…