Christopher Baus bemoans the problem of getting all the libs that he wants to use linked in statically on Linux. Chris wants an executable that will run on lots of different systems with the least amount of pain for all concerned and to do this he’s linking as much as he can statically so that he has a known set of functionality available.
I know this will sound like heresy, but that’s pretty much my approach on Windows and it has been for a long time.
Way, way, back when I worked for Credit Suisse Financial Products (whilst Bryan Boreham was in charge of all things technical), I came to appreciate that if you are writing systems that are important to people, and that have to run reliably on machines that might be used by other people for things that you have no control over, then the way to the fewest support calls is to link statically. We did this on both Solaris and Windows platforms and it worked pretty well.
The interesting thing is that this was in addition to having very strict rules on library versioning so as to preserve binary compatibility (so that a library upgrade could often only require a relink rather than a rebuild) and rules to prevent breaking changes and preserve backwards compatibility. The simple fact was that if you wanted to put your system on a box where other people might be putting their systems then the most reliable way to do it was to have your system depend on the fewest number of things. That way there was less likelihood of someone else ‘fixing’ their system and breaking yours.
Sure there are all manner of good reasons for using dynamic linking but they don’t really matter when the most important goal is keeping the system running as it was when you built and tested it.
Obviously on Windows platforms you can’t statically link to the OS services, believe me I’d like to be able to sometimes, but you can reduce the amount of dynamic linkage that goes on by statically linking your own shared code. Most of our libraries build only as static libs; we pay the price because each of our applications is larger than it might otherwise be, but reap the benefits because we don’t need to re-test all of them if we upgrade a library whilst writing a new application. IMHO, back when disks were small and memory was sparse dynamic linkage had more of a place than it does now.