[matroska-general] The pros of dynamic linking

Steve Lhomme steve.lhomme at free.fr
Thu Mar 6 10:12:26 CET 2003

" NewsForge: Why not do more static linking, especially now that hard drives
have gotten cheap?

Mike: That's a fairly common question, with what is basically a "stock" answer.
I might as well repeat it here, in case some of the readers aren't aware of it....

Basically dynamic linking has several major advantages, besides the reduction in
hard disk space used. It also reduces memory consumption, normally far more of a
concern if you want a responsive UI. It also makes updates much harder. For
instance, take the GTK file selector. That's been a bone of contention for a
long time now in the community. Unfortunately, we won't be getting a new one
until GTK 2.4. By the time GTK 2.4 is released, GNOME 2.4 will already be out
and using GTK 2.2, because the release cycles unfortunately aren't synchronised.
Fortunately GTK preserves backwards compatability, so when 2.4 does come out,
you can simply drop it in and all your apps will get the new file picker.

That's one trivial example of how it can benefit the end user. Obviously stuff
like security updates becomes much harder when things are statically linked. It
also bloats downloads considerably. Hard disks may be cheap, but the majority of
the Net still uses dial-up. We're being pretty careful to keep dialup users in
mind when building autopackage."

Now I remember when W2K was out and the W2K certification program, it was said
that it's better to install the DLLs next to the application instead of the
Windows\System folder. This way you ensure your program will always work as
expected, even though you upgrade your OS or other applications. The updates to
a program should come from the same vendor, not other/unknown ones. Unless you
want to make your system unstable. (the same happens in UNIX, see the dependency

In this case why not using static linking directly ? Because the update could
just be one DLL, instead of the whole binary program. That's the only advantage
I can see. And in this case, you can still use C++ without much problem (as long
as you control the compiler).

Having worked some time with the LAME DLL, everytime a new version is out, I
have to update my code otherwise it may lead to problems. So dynamic linking is
good but not as good as one wuold expect...

More information about the Matroska-general mailing list