Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

What's exactly wrong with dynamic linking?
 help



Software A depends on version 1.34.5678 but my software requires version 1.35.678 and unfortunately 1.35.678 breaks Software A that needs 1.34.5678 and so now I need two DLLs on my machine anyway so all the complexity was for nothing. Now all software just bundles their own copy of the DLL.

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.


This is DLL hell, well-known problem. Replace DLL with Python, NPM, Java and you have exactly the same problem.

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.


I think the problem is that the problem gets trivialized when in reality, it's more difficult than we realize.

I want to use LibraryA in ProgramA and in ProgramB. It would be nice if they could both use the same binary, that way I can save some storage. Also, if I notice a problem in LibraryA, I could fix that and just replace that.

But inevitably, you get to a position where you need to make a change to LibraryA that would make it incompatible with previous versions. There's no nice, clean way to have both all producers and all consumers be both backwards and forwards compatible. Or, at the very least, you have to be aware that's what dynamic linking is asking of your software, that it be both backwards and forwards compatible.


That is very much a developer problem. The version conflicts always have carelessness at its root. You should be able to update the system to version 1.97 and have everyone that relies on 1.x to be happy. The add a package lib2 for the ones that wants 2.x.

Libraries developers breaking API contracts and developers hard requiring only the latest version is what is making a mess.

If there is one thing I like about the BSDs and distros like alpine and arch is how easy it is to create a new package spec. Also easy to setup a repo.


Nix has basically solved this for many years. You can have multiple versions of a dll if someone's a special snowflake, and get sharing if they're not. Without needing to specifically put your shared libraries in a good base layer like Docker. I've been using NixOS for 9-10 years now on all of my computers and it's been pretty much completely hassle free. LLMs can now also manage your config for you so you don't even need to learn it.

The biggest problem is that much like Haskell or Scala, using it causes you to realize that you hate working with anything else, likely making your job satisfaction decrease because you're never going to move your org off Ansible or whatever.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: