【问题标题】:VC++ ATL DLL crashing -- possibly related to 32/64-bit issueVC++ ATL DLL 崩溃——可能与 32/64 位问题有关
【发布时间】:2012-01-13 10:03:27
【问题描述】:

我创建的 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-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

我将所有这些文件从我的开发机器复制到 Windows XP 机器上,现在依赖分析器告诉我:

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.

我不知道从这里去哪里。谁能帮帮我?

编辑

  1. Microsoft Visual C++ 2010 Redistributable Package (x86) 已安装在 Windows XP 计算机上。
  2. 我正在将 DLL 编译为 32 位版本(不是调试)。

【问题讨论】:

    标签: visual-studio-2010 visual-c++ dll 32bit-64bit atl


    【解决方案1】:

    我认为这些 dll 是 specific to Windows 7,因此它们无法在 XP 上运行。我怀疑您的清单文件中有特定于 Windows 7 的内容,或者您​​在 _WIN32_WINNTWINVER 中指定了最低版本,例如参见 http://msdn.microsoft.com/en-us/library/aa383745%28v=vs.85%29.aspx

    要查看清单文件中的内容,请使用mt 工具:

    mt -inputresource:mydll.dll;#1 -out extracted.manifest
    

    【讨论】:

    • 谢谢,the_mandrill...我想你已经找到了解决方案。在我的项目中,WINVER 设置为 0x0600(Windows Vista),因此我将其更改为 0x0501(Windows Server 2003、Windows XP)。这是清单文件的输出:
    • 但是,当我在 dll 上运行依赖 walker 时,它仍然指的是 Windows 7 dll...您有什么想法吗?
    • 我忘了补充说 dll 在 Windows XP 上仍然崩溃。
    • 我刚刚注释掉了 target.h 文件中的所有内容(此处定义了 WINVER 宏)并重新编译...仍然获得相同的 Windows 7 依赖项并崩溃。
    • 清单中没有任何明显错误。我想知道是否不是您的 dll 依赖于这些 Win7 dll,而是您依赖的另一个 dll。在dependencywalker 的树形视图中,它是否显示这些是您自己的dll 或其他dll 的直接依赖关系?另外,您确定它是 32 位二进制文​​件吗?
    猜你喜欢
    • 2011-12-04
    • 2016-03-26
    • 2022-01-20
    • 1970-01-01
    • 2010-11-27
    • 1970-01-01
    • 1970-01-01
    • 2017-02-18
    • 1970-01-01
    相关资源
    最近更新 更多