【发布时间】:2010-01-27 14:45:31
【问题描述】:
我将python.h 包含在我的Visual C++ DLL 文件项目中,这会导致与python25.dll 的隐式链接。但是,我想加载一个特定的python25.dll(计算机上可以存在几个),所以我创建了一个非常简单的清单文件,名为 test.manifest:
<?xml version='1.0' encoding='UTF-8' standalone='yes'?>
<assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'>
<file name="python25.dll" />
</assembly>
我正在将它与 Visual Studio 生成的自动嵌入清单文件合并,这要归功于:
Configuration Properties -> Manifest Tool -> Input and Output -> Additional Manifest Files
-->$(ProjectDir)\src\test.manifest
python25.dll 现在加载了两次:清单请求的一次,以及 Windows 应该通过其搜索顺序找到的一次。
Screendump of Process Explorer http://dl.dropbox.com/u/3545118/python25_dll.png
为什么会发生这种情况,我如何才能加载清单指向的 DLL 文件?
【问题讨论】:
-
隐式加载是如何完成的? python标头中是否有
#pragma comment( lib xxx )? -
是的,由于#pragma 评论,链接已完成。
-
只是出于好奇,如果删除syswow64中的python25.dll会怎样?
-
感谢测试思路,结果很有意思!现在我的“好” dll,即清单所指向的那个,本身被加载了两次!!!
-
您的应用程序和两个 python25.dll 图像都是 32 位的,对吗?您可以查看“图像类型”列。也许这是 wow64 的某种怪癖。
标签: c++ python visual-studio dll manifest