What are the pro and cons of statically linking a library?

Posted by Mathieu Pagé on Stack Overflow See other posts from Stack Overflow or by Mathieu Pagé
Published on 2010-03-16T15:29:06Z Indexed on 2010/03/16 15:31 UTC
Read the original article Hit count: 398

Hi,

I want to release an application I developed as a hobby both for Linux and Windows. This application depends on boost (and possibly other libraries). The norm for this kind of application (a chess engine) is to provide only an executable file and possibly some helper files.

I tough it would be a good idea to statically link the libraries so the executable would not have any dependencies. So the end user can just put the executable in a directory and start using it.

However, while doing some research online I found some negative comments about statically linking libraries, some even arguing that an application with statically linked libraries would be hardly portable, meaning that it would only run on my system of highly similar systems.

So what are the pros and cons of statically linking library?

I already know that the executable will be bigger. But I can't see why it would make my application less portable.

© Stack Overflow or respective owner

Related posts about linux

Related posts about linking