Since VS 2005, I see that it is not possible to simply build a dll against MS runtime and deploy them together (http://www.ddj.com/windows/184406482). I am deeply confused by ma
The simplest thing to do: Assuming a default install of VS2005, you will have a path like:
C:\Program Files\Microsoft Visual Studio 8\VC\redist\x86\Microsoft.VC80.CRT
Go, grab the files in this redist folder, and place the .manifest AND the msvcr80.dll (At least) in your applications .exe folder. These files, present in the root of your installation, should enable your exe and all dlls linked against them, to work flawlessly without resorting to merge modules, MSIs or indeed any kind of just-in-time detection that the runtime is not installed.
Here is the blog entry explaining the rational behind the SxS crt decision for VC++. It includes explaining how bad it is to statically link the crt, and why you shouldn't do that.
Here is the documentation on how to statically link the crt.
Well, I've encountered some of these issues, so perhaps some of my comments will be helpful.
You'll probably want to test on Vista to make sure this is working properly.
If you intend to deploy the Microsoft DLLs/.manifest files and are using Java JNI then you will need to put them in the bin directory of your JDK/JRE.
If you are running the app in JBoss, then you will need to put them in the JBoss/bin directory.
You can put your JNI DLL where appropriate for your application.
They are redistributable and you have redistributable packages inside msvs directory.
Build with runtime of your choice, add corresponding package to your installer and don't bother - it will work. The difference is - they are installed in a different place now (but that is also where your app is going to look for libraries).
Otherwise, MSDN or basically any not-too-old book on windows c++ programming.
We use a simple include file in all our applications & DLL's, vcmanifest.h, then set all projects to embedded the manifest file.
vcmanifest.h
/*----------------------------------------------------------------------------*/
#if _MSC_VER >= 1400
/*----------------------------------------------------------------------------*/
#pragma message ( "Setting up manifest..." )
/*----------------------------------------------------------------------------*/
#ifndef _CRT_ASSEMBLY_VERSION
#include <crtassem.h>
#endif
/*----------------------------------------------------------------------------*/
#ifdef WIN64
#pragma message ( "processorArchitecture=amd64" )
#define MF_PROCESSORARCHITECTURE "amd64"
#else
#pragma message ( "processorArchitecture=x86" )
#define MF_PROCESSORARCHITECTURE "x86"
#endif
/*----------------------------------------------------------------------------*/
#pragma message ( "Microsoft.Windows.Common-Controls=6.0.0.0")
#pragma comment ( linker,"/manifestdependency:\"type='win32' " \
"name='Microsoft.Windows.Common-Controls' " \
"version='6.0.0.0' " \
"processorArchitecture='" MF_PROCESSORARCHITECTURE "' " \
"publicKeyToken='6595b64144ccf1df'\"" )
/*----------------------------------------------------------------------------*/
#ifdef _DEBUG
#pragma message ( __LIBRARIES_ASSEMBLY_NAME_PREFIX ".DebugCRT=" _CRT_ASSEMBLY_VERSION )
#pragma comment(linker,"/manifestdependency:\"type='win32' " \
"name='" __LIBRARIES_ASSEMBLY_NAME_PREFIX ".DebugCRT' " \
"version='" _CRT_ASSEMBLY_VERSION "' " \
"processorArchitecture='" MF_PROCESSORARCHITECTURE "' " \
"publicKeyToken='" _VC_ASSEMBLY_PUBLICKEYTOKEN "'\"")
#else
#pragma message ( __LIBRARIES_ASSEMBLY_NAME_PREFIX ".CRT=" _CRT_ASSEMBLY_VERSION )
#pragma comment(linker,"/manifestdependency:\"type='win32' " \
"name='" __LIBRARIES_ASSEMBLY_NAME_PREFIX ".CRT' " \
"version='" _CRT_ASSEMBLY_VERSION "' " \
"processorArchitecture='" MF_PROCESSORARCHITECTURE "' " \
"publicKeyToken='" _VC_ASSEMBLY_PUBLICKEYTOKEN "'\"")
#endif
/*----------------------------------------------------------------------------*/
#ifdef _MFC_ASSEMBLY_VERSION
#ifdef _DEBUG
#pragma message ( __LIBRARIES_ASSEMBLY_NAME_PREFIX ".MFC=" _CRT_ASSEMBLY_VERSION )
#pragma comment(linker,"/manifestdependency:\"type='win32' " \
"name='" __LIBRARIES_ASSEMBLY_NAME_PREFIX ".MFC' " \
"version='" _MFC_ASSEMBLY_VERSION "' " \
"processorArchitecture='" MF_PROCESSORARCHITECTURE "' " \
"publicKeyToken='" _VC_ASSEMBLY_PUBLICKEYTOKEN "'\"")
#else
#pragma message ( __LIBRARIES_ASSEMBLY_NAME_PREFIX ".MFC=" _CRT_ASSEMBLY_VERSION )
#pragma comment(linker,"/manifestdependency:\"type='win32' " \
"name='" __LIBRARIES_ASSEMBLY_NAME_PREFIX ".MFC' " \
"version='" _MFC_ASSEMBLY_VERSION "' " \
"processorArchitecture='" MF_PROCESSORARCHITECTURE "' " \
"publicKeyToken='" _VC_ASSEMBLY_PUBLICKEYTOKEN "'\"")
#endif
#endif /* _MFC_ASSEMBLY_VERSION */
/*----------------------------------------------------------------------------*/
#endif /* _MSC_VER */
/*----------------------------------------------------------------------------*/