Then I want to use Library Z but it requires version 1.45 of the DLL and I need to use 1.47 for a new feature but it is incompatible with Library Z and so now there is a conflict that can't be resolved.
Software T requires version 2.3 but my Linux distribution only ships version 1.8 and so I can't use that software until the distro updates at some indeterminate time in the future.
Software G requires version 2.3 but Ubuntu ships version 1.7 and Gentoo ships 1.97 and Debian only has 1.6 installed so the number of linux distros that can run the software is limited.
If dynamic linking is used right, it has a lot of advantages. libSystem/dyld_shared_cache in darwin/XNU is a good example how to do it right.
- Size: shared libraries save some disk space. But disks are absurdly large these days compared to executable code, and in practice, code is never the thing that's going to fill up your disk. Your disk is going to be full of data, not code. (Or whichever hybrid of "code" and "data" you want to call a set of neural network weights...)
- Memory: shared libraries can theoretically have the same mapped code pages in memory across several processes. Marginally more interesting, but still not where most of your RAM is going today.
- Upgrades, maintenance, and build time: the expectation that if there's a bug in the shared library, you can update the shared library, and not need to update all the software built atop it. The most interesting reason that's still remaining, but not enough to put up with the tradeoffs of dynamic linking. You'd still have to restart all the applications that have that shared library loaded, so you don't get any logistical isolation there (whereas you would with components communicating via some RPC protocol). You may well have to rebuild things anyway, if the bug is in anything that gets inlined into the application. You have versioning problems, and all the clever schemes like symbol versioning are used by vanishingly few libraries (mostly glibc). And ultimately, rebuilding software isn't nearly as expensive as it used to be, because we have a lot more computing power now.
Dynamic linking seems like a tradeoff designed when the most interesting shared library on your system was libc. It imposes logistical and efficiency costs on everything. And it doesn't buy enough to be worth it.
I do definitely agree for dynamic linking though. It was mostly a disk space saving measure. If one insists it could be a compatibility feature too.
So just like today then? (Tongue only partially in cheek.)
Sounds like a good idea in general. Memory savings are a welcome side-effect.
Static linking is simpler but does away with those advantages.
I suppose much hatred against DL isn't the concept itself, but specific implementations. Like, any which do the versioning / dependency management badly.
You can't just strip and inline the parts of the lib you need. You still probably need to pack in the DLLs you want in case the end users might not have a way to easily procure them elsewhere. Its a big ol' mess...