2

按照类似的 SO question中提出的解决方案,我想在 C++ CLI 应用程序(或者实际上是 C#)中加载一个相当复杂的 dll 文件。目标架构始终设置为 64 位。

在这个应用程序中使用的 .dll 是在另一个项目中生成的,它是使用 C++ CLI 使用本地 C++ 库(例如 Ogre、Boost 等)编写的,并且依赖于它自己的 dll(所有这些都已编译为 64 位平台)。这些依赖 dll 与使用它们的讨厌的 .dll 一起复制到我的应用程序的输出文件夹中。

但是,当到达这条线时:

Assembly^ SampleAssembly;
SampleAssembly = Assembly::LoadFrom( "E:\\x64\\Debug\\OgreWrapper.dll" );

输出控制台显示:

'DumbTestCLR.exe': Loaded 'E:\x64\Debug\OgreWrapper.dll', Symbols loaded.
'DumbTestCLR.exe': Unloaded 'E:\x64\Debug\OgreWrapper.dll'

并抛出一些致命的未捕获异常:

First-chance exception at 0x000007fefe32cacd (KernelBase.dll) in DumbTestCLR.exe: Microsoft C++ exception: EEFileLoadException * __ptr64 at memory location 0x0016d588..
First-chance exception at 0x77cace3b (ntdll.dll) in DumbTestCLR.exe: 0xC0000005: Access violation reading location 0xffffffffffffffff.
First-chance exception at 0x77cace3b (ntdll.dll) in DumbTestCLR.exe: 0xC0000005: Access violation reading location 0xffffffffffffffff.
First-chance exception at 0x77cace3b (ntdll.dll) in DumbTestCLR.exe: 0xC0000005: Access violation reading location 0xffffffffffffffff.

由于此处给出的建议均不适用(即不是因为应用程序和 dll 之间的位数冲突),问题的根源可能是什么?我怀疑 dll 无法加载其他(本机)dll 并因此崩溃,但是如果可能是这种情况,如何检查哪些 dll 导致了问题?

很抱歉这个问题很长,也许是愚蠢的问题..

4

1 回答 1

2

使用Dependency Walker查看 dll 的依赖项是否都在那里。

于 2012-07-23T13:11:57.570 回答