VC++ ATL DLL 崩溃——可能与 32/64 位问题有关
我创建的 32 位 ATL dll 出现问题 — 每当我在 Windows XP(32 位)计算机上使用该 dll 时,它就会崩溃,且没有任何警告。我认为这个问题与我编译 dll 的 Windows 版本有关,但我不确定。简单介绍一下历史:
我最初使用 Visual Studio 2008 在 Windows XP(32 位)机器上开发了该 dll。该版本的 dll 在 Windows XP(32 位)和 Windows 7(32 位和 64 位)上运行良好-少量)。然后,我得到了一个带有 Windows 7(64 位)和 Visual Studio 2010 的新开发盒。我将 VS2008 项目转换为 VS2010,编译它,它在 Windows 7(32 位和 64 位)机器上完美运行;但是,当我在 Windows XP(32 位)上运行它时,它崩溃了。
有趣的是,我能够在 XP 计算机上成功 regsv32 dll,但是当我运行 dependency walker 时,它说它丢失了一堆文件:
api-ms-win-core-console-l1 -1-0.dll
api-ms-win-core-datetime-l1-1-0.dll
api-ms-win-core-debug-l1-1-0.dll
api-ms-win-core-delayload-l1-1-0.dll
api-ms-win-core-errorhandling-l1-1-0.dll
api-ms-win-core-fibres-l1-1-0.dll
api-ms-win-core-file-l1-1-0.dll
api-ms-win-core-handle-l1-1-0.dll
api-ms-win-core-heap-l1-1-0.dll
api-ms-win-core-interlocked-l1-1-0.dll
api-ms-win-core-io-l1-1-0.dll
api-ms-win-core-libraryloader-l1-1-0.dll
...还有更多相同的
我将所有这些文件从我的开发计算机复制到 Windows XP 框中,现在 dependency walker 告诉我:
错误:“c:\documents and settings\poibri01\desktop\distributable\WERUI.DLL”的并排配置信息包含错误。由于应用程序配置不正确,该应用程序无法启动。重新安装应用程序可能会解决此问题 (14001)。
错误:发现具有不同 CPU 类型的模块。
警告:由于延迟加载相关模块中缺少导出功能,至少有一个模块存在未解析的导入。
我不知道从这里该去哪里。谁能帮助我吗?
编辑
- Microsoft Visual C++ 2010 Redistributable Package (x86) 安装在 Windows XP 计算机上。
- 我正在将 DLL 编译为 32 位版本(不是调试版本)。
I am having a problem with a 32-bit ATL dll that I have created---whenever I use the dll on a Windows XP (32-bit) computer it crashes without any warnings. I think the issue is related to the version of Windows that I compiled the dll on, but I'm not sure. Just a bit of history:
I initially developed the dll on a Windows XP (32-bit) box with Visual Studio 2008. This version of the dll worked fine on Windows XP (32-bit) and Windows 7 (32-bit and 64-bit). Then, I got a new development box with Windows 7 (64-bit) and Visual Studio 2010. I converted my VS2008 project to VS2010, compiled it and it works perfectly on Windows 7 (32-bit and 64-bit) machines; however, when I run it on a Windows XP (32-bit), it crashes.
The funny thing is that I was able to successful regsv32 the dll on the XP machine, but when I ran dependency walker, it said that it was missing a bunch of files:
api-ms-win-core-console-l1-1-0.dll
api-ms-win-core-datetime-l1-1-0.dll
api-ms-win-core-debug-l1-1-0.dll
api-ms-win-core-delayload-l1-1-0.dll
api-ms-win-core-errorhandling-l1-1-0.dll
api-ms-win-core-fibers-l1-1-0.dll
api-ms-win-core-file-l1-1-0.dll
api-ms-win-core-handle-l1-1-0.dll
api-ms-win-core-heap-l1-1-0.dll
api-ms-win-core-interlocked-l1-1-0.dll
api-ms-win-core-io-l1-1-0.dll
api-ms-win-core-libraryloader-l1-1-0.dll
...any many more of the same
I copied all of these files from my development machine to the Windows XP box and now dependency walker tells me:
Error: The Side-by-Side configuration information for "c:\documents and settings\poibri01\desktop\distributable\WERUI.DLL" contains errors. This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem (14001).
Error: Modules with different CPU types were found.
Warning: At least one module has an unresolved import due to a missing export function in a delay-load dependent module.
I don't know where to go from here. Can anyone help me?
Edit
- Microsoft Visual C++ 2010 Redistributable Package (x86) is installed on the Windows XP machine.
- I am compiling the DLL as a 32-bit Release (not Debug).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为这些 dll特定于 Windows 7,因此它们不能在 XP 上运行。我怀疑您的清单文件中有特定于 Windows 7 的内容,或者您在
_WIN32_WINNT
或WINVER
中指定了最低版本,例如,请参阅 http://msdn.microsoft.com/en-us/library/aa383745%28v=vs.85%29.aspx要查看清单文件中的内容,请使用 mt 工具:
These dlls I think are specific to Windows 7, so they won't work on XP. I suspect that either you have something in the manifest file that's specific to Windows 7 or you are specifying a minimum version in
_WIN32_WINNT
orWINVER
, eg see http://msdn.microsoft.com/en-us/library/aa383745%28v=vs.85%29.aspxTo see what's in the manifest file, use the mt tool: