Difference between static linking and dynamic linking

static linking increase the file size of your program and it may increase the code size in memory if other applications are running on the system... on the other hand dynamic linked program take up less space and less virtual memory


Static linking is done at 'compile time' by a tool called a linker. Dynamic linking is done at run time, by the operating system.


In static linking, functions and variables which are defined in external library files are linked inside your executable. That means that the code is actually linked against your code when compiling/linking.

With dynamic linking external functions that you use in your software are not linked against your executable. Instead they reside in a external library files which are only referenced by your software. Ie: the compiler/linker instructs the software on where to find the used functions.

On windows platforms you can even explicitly load DLL files at run time and hook up the functions contained in the DLL.

Tags:

Dll