vc++ ATL DLL崩溃——可能与32/64位问题有关



我创建的32位ATL dll有问题——每当我在Windows XP(32位)计算机上使用dll时,它就会崩溃,没有任何警告。我认为这个问题与我编译dll的Windows版本有关,但我不确定。只是一点历史:

我最初是在Windows XP(32位)机器上使用Visual Studio 2008开发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,但当我运行依赖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盒子中,现在依赖项walker告诉我:

Error: The Side-by-Side configuration information for "c:documents and settingspoibri01desktopdistributableWERUI.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位版本(不是调试)。

我认为这些dll是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

最新更新