Dynamic linking
By far the most important reason for dynamic linking for C is semantics: static linking semantics are stuck in 1978 and suck (more on that below), while dynamic linking semantics make C a much better language.<p>In particular, static linking for C has two serious problems:<p>1. symbol collisions -&gt; accidental interposition (and crashes);<p>2. you have to flatten the dependency tree into a topological sort at the final link-edit.<p>Both of these are related, and they are disastrous.  They are also related to the lack of namespaces in C.<p>Besides fixing these issues, the C dynamic linking universe also enables things like:<p>- run-time code injection via LD_PRELOAD and intended interposition<p>- run-time code loading&#x2F;injection via dlopen(3)<p>- audit (sotruss)<p>- reflection<p>- filters (which allow one to move parts of libraries contents to other libraries without forcing re-links and without forcing built systems to change to add new -lfoo arguments to link-edits)<p>- use of dladdr(3) to find an object&#x27;s install location, and then that to find related assets&#x27; install locations relative to the first, which then yields code that can be relocated at deploy time (sure, &quot;don&#x27;t do that&quot; is a great answer, but if you statically-link then you think you can, and now you just can&#x27;t have assets to load at run-time)<p>- use of weak symbols to detect whether a process has some library loaded<p>and others.<p>C with those features is a far superior language -- a different language, really -- to C without them.<p>(EDIT: A lot of the semantics of ELF could be brought to static linking.  Static link archives could have a .o that has metadata like depedencies, &quot;rpaths&quot;, exported&#x2F;protected symbols, interposer symbols, etc.  The link-editor would write and consume that metadata.  However, it&#x27;s 2020, and the static link ecosystem is stuck in 1980 because no one has bothered, and no one has bothered because dynamic linking is pretty awesome.  Still, it could be done, and once in a while I think I ought to do it to help save people from themselves who want static linking.)<p>&gt; Do your installed programs share dynamic libraries?<p>&gt; Findings: not really<p>&gt; Over half of your libraries are used by fewer than 0.1% of your executables.<p>The C library most certainly gets shared, as well as libm and such.  The rest, it&#x27;s true, not so much, but it does depend on what you&#x27;re measuring.  Are you measuring C++ apps?  Yeah, C++ monomorphization leads to essentially static linking.  Are you measuring Java apps with no significant JNI usage?  You won&#x27;t find much outside the libraries the JVM uses.<p>&gt; Is loading dynamically linked programs faster?<p>&gt; Findings: definitely not<p>Dynamically-linked programs will load faster when their dependencies are already loaded in memory, and slower otherwise.  The biggest win here is the C library.<p>&gt; Will security vulnerabilities in libraries that have been statically linked cause large or unmanagable updates?<p>&gt; Findings: not really<p>Correct.  But, being able to update libc or some such and not have to worry about updating consumers you might not even know about is a very nice feature.