Issue
I am new in C programing.I have no Idea about .so files. what is the need of it ? how can I create it ? how to bind my C code or Binary with it ? If I don't make any .so file and directly make executable binary of C code what are the PROS and CONS of it ? need a detail description of it.
Solution
.so
files are shared objects. Usually shared libraries are made as .so
.
By making a library a .so
you achieve efficiency in memory usage. i.e. when multiple applications which use the library are running, the library is loaded into the memory only once as opposed to the case of static libraries.
Creation of dynamic library:
gcc -Wall -fPIC -c *.c
gcc -shared -Wl,-soname,libctest.so.1 -o libctest.so.1.0 *.o
-fPIC
: Compiler directive to output position independent code, a characteristic required by shared libraries.
-shared
: Produce a shared object which can then be linked with other objects to form an executable.
You can find more information here.
Answered By - CCoder Answer Checked By - Mildred Charles (WPSolving Admin)