Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are .a and .so files?

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?

like image 735
Dunc Avatar asked Mar 21 '12 16:03

Dunc


People also ask

What is the difference between .a and .so files?

A . a file is a static library, while a . so file is a shared object dynamic library similar to a DLL on Windows.

What are .so files used for?

An SO file is a shared library used by programs installed on the Linux and Android operating systems. It contains common program functions and logic that multiple programs require access to.

What are .a files in Linux?

In general, libraries are collections of data and functions written to be reused by other programmers or programs. On Linux, archive libraries end with the . a extension, and shared object libraries end with the . so extension.

What are .a files?

a is a static library (archive), while . so is a shared library (shared object).


1 Answers

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

like image 89
Leafy Avatar answered Oct 05 '22 06:10

Leafy