[Qt-interest] LGPL and static linking

Paul Floyd paulf at free.fr
Tue Dec 1 15:54:35 CET 2009


Quoting Konrad Rosenbaum <konrad at silmor.de>:


> out of curiosity: why do people prefer static linking? Why do you consider
> dynamic linking bad?
>
> Maybe this discussion helps to enlighten all of us... ;-)

As far as I'm aware there are two main advantages to static linking.

1) Size [files and memory footprint]. The statically linked app only extacts
those functions and data that it requires from static libraries, whilst dynamic
libraries have to keep everything. When you have more than one application using
the library/ies, then dynamic linking can have an advantage. Additionally,
linking options like lazyload can reduce the memory footprint.

2) Speed. Dynamic libs get compiled with position independent code (pic). This
is generally slower, as global data and functions need to 'bounce' off an
offset. Code in static libs can access globals and call functions directly.

A lesser reason is that it avoids "DLL hell" problems.

A+
Paul
-- 
Paul Floyd   http://paulf.free.fr



More information about the Qt-interest-old mailing list