The dreaded “Application failed to initialize properly”

Developing in Visual C++, I came across the dreaded “Application failed to initialize properly” error. This is usually caused by a missing DLL, but in this case all the DLLs were there.

I finally realized that a static variable in one of the DLLs was throwing an exception in its constructor, causing the load to fail.