在Windows上构建和部署dll:SxS,显示和所有爵士乐 [英] Building and deploying dll on windows: SxS, manifests and all that jazz
问题描述
自VS 2005以来,我看到不可能简单地构建一个dll对MS运行时和部署在一起( http://www.ddj.com/windows/184406482 )。我很清楚,SxS和co:MSDN文件真的很差,有循环引用;特别是因为我更是一个Unix的人,我发现所有那些不知情的人。我的核心问题是将DLL与msvc9或msvc8连接起来:由于这些运行时并不是可再分发的,所以链接和部署这样一个dll的步骤是什么?特别是,清单生成(我不想要mt.exe,我想要一些可以在编译器中移植的东西),它们是如何嵌入,使用的?并排组装是什么意思?
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 manifest, SxS and co: MSDN documentation is really poor, with circular references; specially since I am more a Unix guy, I find all those uninformative. My core problem is linking a dll against msvc9 or msvc8: since those runtime are not redistributable, what are the steps to link and deploy such a dll ? In particular, how are the manifest generated (I don't want mt.exe, I want something which is portable across compilers), how are they embedded, used ? What does Side by side assembly mean ?
基本上,在哪里可以找到任何种类的规范,而不是MS术语?
Basically, where can I find any kind of specification instead of MS jargon ?
感谢所有回答的人,这真的很有帮助,
Thank you to everyone who answered, this was really helpful,
推荐答案
我们在所有应用程序中使用一个简单的包含文件&安培; DLL的vcmanifest.h然后将所有项目设置为嵌入清单文件。
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
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 */
/*----------------------------------------------------------------------------*/
这篇关于在Windows上构建和部署dll:SxS,显示和所有爵士乐的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!