Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org
#

Q1245 What is the difference between statically and dynamically linked executables?

You are here: irt.org | FAQ | Linux | Q1245 [ previous next ]

It tells you how the programs were compiled. All but the simplest of programs will use functions that are part of common libraries.

When the source code is compliled, usually dynamic linking is used. This means that the program will be smaller as the common functions will not be part of the program. However, to be able to run, it will need the correct libraries to be present on your system. The README file that comes with the distribution should tell you which libraries (and versions) you will need. Dynamically linked programs also mean that the library functions only need to find their way into memory once. So as well as saving some disk space, you also save memory as more programs share some of the same space.

A statically linked program means that the common functions from the libraries have been compiled into the program. So if you see a Linux executable that has been statically linked, then you won't run into trouble trying to get it to work if you a lacking a library file, or have a version of the library that is too old. There is also another advantage, and that is that your program 'may' run a little faster with statically linked libraries.

©2018 Martin Webb