2010/01/22

Windows Side-by-side Assemblies

From Visual Studio 2005, WinSxS became a mandatory things for Windows application. Especially when you depends on some common DLL components, for example, Common Controls, MS VC CRT, MS GdiPlus. All this need to be specified with the MANIFEST file.
It is a little noisily to generate the MANIFEST manually. So Microsoft do this for you. Indeed, the MANIFEST file was created by `link.exe'. In the C/C++ header file, it is using #pragma instrument to specify the DLL dependency explicitly.

For example MSVCRT: it is specified by 'crtdefs.h' and 'crtassem.h'.
Inside crtdefs.h, it defines the linker comment, like below:

#ifdef _DEBUG
#pragma comment(linker,"/manifestdependency:\"type='win32' "            \
        "name='" __LIBRARIES_ASSEMBLY_NAME_PREFIX ".DebugCRT' "         \
        "version='" _CRT_ASSEMBLY_VERSION "' "                          \
        "processorArchitecture='x86' "                                  \
        "publicKeyToken='" _VC_ASSEMBLY_PUBLICKEYTOKEN "'\"")
#else
#pragma comment(linker,"/manifestdependency:\"type='win32' "            \
        "name='" __LIBRARIES_ASSEMBLY_NAME_PREFIX ".CRT' "              \
        "version='" _CRT_ASSEMBLY_VERSION "' "                          \
        "processorArchitecture='x86' "                                  \
        "publicKeyToken='" _VC_ASSEMBLY_PUBLICKEYTOKEN "'\"")
#endif

and all the variants, e.g. __LIBRARIES_ASSEMBLY_NAME_PREFIX, __VCASSEMBLY_PUBLICKEYTOKEN, were defined inside `crtassem.h'.

1 条评论:

asdasd 说...

Hi,

Our blogs looks very similar, do visit mine,

My blog
http://supercomputers1tech.blogspot.com/

BlockChain 相关电子书

@copyright of Sam Chadwick   - https://thehub.thomsonreuters.com/groups/bitcoin/blog/2017/09/10/blockchain-paper Blockchain Papers A c...