我有一个 C++ 类库和一个使用该库的 C# Windows 应用程序。
它在 32 位 Windows 上运行良好,但在 64 位 Windows 上运行不佳 - BadImageFormatException
发生了。
我尝试更改C++类库的平台,但是无法从WIN32更改为WIN64。
我认为以下问题之一可以解决这个问题。
- 有没有办法将 WIN32 库转换为 WIN64 库?
- 有没有其他方法可以在不使用 C++ 库的情况下在 C# 上调用 C++ 函数?
- 是否可以在 64 位应用程序中加载 WIN32 库?
最佳答案
Is there a way to convert WIN32 Library to WIN64 Library?
将库重建(重新编译)为 64 位库。
Is it possible to load WIN32 Library in 64 bit application?
没有。来自 Programming Guide for 64-bit Windows :
... 32-bit processes cannot load 64-bit DLLs for execution, and 64-bit processes cannot load 32-bit DLLs for execution.
关于c# - 从 C#(64 位)加载 C++ 类库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13124535/