LINUX programming

Moderators: ITA
Number of threads: 1339
Number of posts: 2924

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
static or shared library? Posted by miroslav_karpi on 29 Jan 2009 at 5:05 AM
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....
Report
Re: static or shared library? Posted by markk2009 on 29 Jan 2009 at 5:30 AM
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
Report
Re: static or shared library? Posted by miroslav_karpi on 29 Jan 2009 at 5:48 AM
Report
Re: static or shared library? Posted by gustavo-serra on 19 Feb 2009 at 5:54 AM
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.



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.