What are .a and .so files?

Dunc picture Dunc · Mar 21, 2012 · Viewed 384.1k times · Source

I'm currently trying to port a C application to AIX and am getting confused. What are .a and .so files and how are they used when building/running an application?

Answer

Leafy picture Leafy · Mar 21, 2012

Archive libraries (.a) are statically linked i.e when you compile your program with -c option in gcc. So, if there's any change in library, you need to compile and build your code again.

The advantage of .so (shared object) over .a library is that they are linked during the runtime i.e. after creation of your .o file -o option in gcc. So, if there's any change in .so file, you don't need to recompile your main program. But make sure that your main program is linked to the new .so file with ln command.

This will help you to build the .so files. http://www.yolinux.com/TUTORIALS/LibraryArchives-StaticAndDynamic.html

Hope this helps.