File this under something I learned about Visual C++ programming even though I've been programming it for 15+ years.
OK, so today I'm testing ipPulse 1.70 on different operating systems, Windows 7 (32 & 64), 2008, XP etc. On one completely up to date, fully patched Windows XP system I get the fateful message "cannot find MSVCR90.DLL" blah, blah. I've seen this before. It's the sign of missing side by side DLLs from the SXS directory. But wait! I didn't compile this to use the SXS DLLs - it's all supposed to be static. What's going on?
I started by using the better version of Dependency Walker to check each exe and dll. I find that one dll has the linkage to the SXS directoried (is that a word?) MSVCR90.DLL. So I look at the release flags and for static it is what it should be: /MT. BUGGGER! So next I go to MSDN help pages and carefully review the /MT and /MD flags. I don't see anything obvious, so I remove msvcr90.lib from the linker. Bad idea. Errors galore. I put it back and go back to the docs. I see a reference to libcmt.lib in the same context as /MT. I wonder. I go and remove msvcr90.lib and put libcmt.lib in there instead. The linker loves it. I review the output dll and see the offending SXS linkage is gone. Great! After rebuilding the ipPulse fileset I see that it now runs properly on that other XP system. I never knew that about libcmt.lib and /MT symbiotic relationship. The docs are not clear. So I learned something new today.
I developed ipPulse 1.70 on MS Visual Studio C++ 2008 with static linkage for all files. The DLL in question was pure C. MSVCR90.DLL is the Visual C runtime DLL.
Don't ask me why I didn't use the 2010 compiler.
No comments:
Post a Comment