Static or dynamic linking the CRT, MFC, ATL, etc

Rob picture Rob · Oct 26, 2008 · Viewed 15.2k times · Source

Back in the 90s when I first started out with MFC I used to dynamically link my apps and shipped the relevant MFC DLLs. This caused me a few issues (DLL hell!) and I switched to statically linking instead - not just for MFC, but for the CRT and ATL. Other than larger EXE files, statically linking has never caused me any problems at all - so are there any downsides that other people have come across? Is there a good reason for revisiting dynamic linking again? My apps are mainly STL/Boost nowadays FWIW.

Answer

Kevin Laity picture Kevin Laity · Jan 16, 2009

Most of the answers I hear about this involve sharing your dll's with other programs, or having those dll's be updated without the need to patch your software.

Frankly I consider those to be downsides, not upsides. When a third party dll is updated, it can change enough to break your software. And these days, hard drive space isn't as precious as it once was, an extra 500k in your executable? Who cares?

  • Being 100% sure of the version of dll that your software is using is a good thing.
  • Being 100% sure that the client is not going to have a dependency headache is a good thing.

The upsides far outweigh the downsides in my opinion