Qt DLL Version Use

Another example of DLL Hell in action.

I run into a problem while building a new development system this last week. I had previously been using Windows XP Pro and Microsoft Visual Studio 2008. On the new system I moved to Windows 7 Ultimate and MS VS 2010. The problems started right away. A program that I previously built on VS 2008 would not run when installed on the new system. Installing programs built with VS 2010 on the new system and loading Qt DLLs from the older VS 2008 system caused things like this to happen:

The old VS 2005 Depends program is great for debugging these problems. Too bad it isn't included with the newer versions.

As you can see, there is no entry in the QtGui4.dll module to match what the program expects. Well that's odd. It appears that VS 2008 and VS 2010 mangle C++ entry names differently. Is this a bug in the MS C++ compiler? I don't know. I sure didn't expect this to be the case as I've never seen it with any other compiler.

Well now we know. Always distribute Qt Framework DLLs built with the same compiler that you build your programs with. This seems to totally remove any advantages of using DLLs in the first place if a new compiler creates programs that won't work with DLLs compiled by an older compiler.

In Case You Wonder

You may ask yourself what I was doing running a program compiled with VS 2010 with DLLs from VS 2008 in the first place. As usual, I was in a hurry and wanted to see if a program I was working on would have any problems using the new compiler. I normally copy the proper DLLs to my installer cache, so the install building program always has the same DLLs to create the install file, but in this case I thought I could get away with the VS 2008 DLL files. They were the same Qt version 4.8.2, just a different compiler.

© James S. Gibbons 1987-2015