static or shared library?

Hi All, I'm kind of new in linux programming.

I'm going to make a library that should be used by one or more applications together (with this I mean that at the same time they can call the library).

The question now is if it should be shared or static one...??
I was reading a bit about both but to be honest is still not 100% clear to me....


  • Hi,

    I am new to Linux programming as well and it would be good to have the knowledge, so anyone that knows how to do this, it would be helpful. Thanks
  • The reason to use a shared library is that is saves memory space. Imagine that you develop a library that is going to be used by a lot of softwares (like zlib), it doesn't make sense that each software has its own copy of the library. So, a shared library will be shared among all the softwares that use it. Using a sahred library you don't need to recompile all your software if you make any changes to the library itself (but only if the interface of the library didn't change). A static library is good for simplicity: a small library, that is not going to change a lot and that won't be used by many different softwares.

    Hope that I've helped you.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!