<Query> Regarding static and shared (dynamic) libraries linking

Leelakrishna A amudala.krishna at gmail.com
Wed Mar 23 05:25:29 EDT 2011


Hi All,

I have few doubts regarding static and shared (dynamic) libraries linking.
Can anybody please clarify it.

There are two kinds of libraries - static libary(.a file) and shared library
(.so file).
Also there are two types of library linkages static linkage and dynamic
linkage.

So Static library can be linked to an executable in either ways (Statically
and dynamically).
in the same way shared libraries can be linked to executable in both the
ways (Statically and dynamically).

Here my doubt is what is the use if we statically linked the shared library
to the executable binary
(by this way the shared library is part of the executable) and what is the
point in calling it as shared libary if it can be linked statically to the
executable file.


If we linked the shared library to the executable file using dynamic
linkage, executable file will pick the library at run time.
Here my doubt is to pick up the library at run time who will load the
library into the memory and how will the executable know about the address
of the function in the library to invoke the function.

Thanks in advance,
Leela krishna.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20110323/ac088b33/attachment.html 


More information about the Kernelnewbies mailing list