为什么 SWIG 需要使用 mt.exe 生成清单文件?
我正在测试 swig,发现 SWIG 的 vcxproj 文件运行 mt.exe 来生成清单文件。
swig -c++ -csharp example.i
CL.exe ... -> compile the c++ source
link.exe ... -> generate dll
mt.exe ...
Csc.exe ...
这是做什么用的?我跳过了 mt.exe,但它似乎工作正常。
I'm testing swig, and I found that SWIG's vcxproj file runs the mt.exe to generate the manifest file.
swig -c++ -csharp example.i
CL.exe ... -> compile the c++ source
link.exe ... -> generate dll
mt.exe ...
Csc.exe ...
What is this for? I skipped the mt.exe, but it seems to work fine.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在 2010 年之前的 VS 版本中,这是一件非常重要的事情。 mt.exe 将自动生成的清单嵌入到可执行映像中,这对于获取存储在列出的 Windows 并行缓存中的 DLL 依赖项非常重要。没什么大不了的,它现在只嵌入一个“我与 Vista 兼容”清单。并行缓存相当令人头疼,在 VS2010 中被放弃了。
您应该检查构建目录中的 .manifest 文件并确保其中没有任何重要内容。就像启用视觉样式的通用对话框版本 6 条目一样。
It was a Very Big Deal in versions of VS prior to 2010. mt.exe embeds the auto-generated manifest in the executable image, important to get the DLL dependencies that are stored in the Windows side-by-side cache listed. Not much of a big deal anymore, it only embeds an "I'm compatible with Vista" manifest now. The side-by-side cache was rather a big headache and abandoned for VS2010.
You ought to check the .manifest file in the build directory and make sure nothing important is in it. Like the common dialogs version 6 entry that enables visual styles.
这与 SWIG 无关,而是与 Visual C++ 生成其二进制输出的方式有关。
mt.exe 工具 不生成一个清单文件,它嵌入已经存在的清单文件中的信息(我认为链接器会创建它)到输出DLL中。如果没有这个,输出 DLL 只能在清单文件与 DLL 位于同一目录中时才能工作。
(注意:我从来没有真正费心去深入了解清单,其中到底有什么信息,以及是否一直需要其中的所有信息,但由于当您在 VC++ 中创建 exe 或 dll 时,这一切都会自动完成,因此应该除非出现问题,否则不需要立即打扰:-)
This has nothing to do with SWIG, but with how Visual C++ generates it's binary output.
The mt.exe tool does not generate a manifest file, it embeds the info from the manifest file that is already there (I think the linker would have created it) into the output DLL. Without this, the output DLL may only work while the manifest file resides along the DLL in the same directory.
(Note: I never really bothered to dig deeper regarding manifests, what info is exactly in there and if all the info in there is needed all the time, but since it's just all done automatically when you create an exe or dll in VC++ one shouldn't immediately need to bother unless something's not working :-)