This page has instructions how to deploy a local copy of VC++ 2008 libraries with your app, to avoid having to install 3rd-party vcredist. This is useful to me because it would let me send a zipped folder to users they can run without having to use an installer, which is disliked.
But, it doesn’t work for me. My app doesn’t use MFC, just Win32 and is otherwise standard C++. I have app/MyApp.exe and that’s it… which files should I be copying from %PROGDIR%\Microsoft Visual Studio 9.0\VC\Redist\x86 and exactly where should they go?
I am testing this on an XP-Mode Virtual PC and when I am trying to follow the instructions in the page, copying files across makes no change to getting the “The application failed to initialize” error. Is there some step I am missing?
I had a look at my manifest and it seems as expected only CRT is used: http://pastebin.com/BD4NZMC2
The easiest way to workaround the DLL-hell is recompiling your application with /MT compiler flag (instead of default /MD). This will link the C runtime libs statically.
If this is a standalone exe, this will always work.
If not (i.e you have your own DLLs), you have to take care that you allocate and release memory in the same module – that is, if you malloc() a piece of memory in executable and free() the same pointer in DLL, it will crash – as both executable and DLL will get their own heaps, and attempting a free() on mismatched heap won’t work.