从 64 位进程调用 32 位代码 [英] Calling 32bit Code from 64bit Process
问题描述
我有一个应用程序,我们正尝试从 32 位迁移到 64 位.它是 .NET,使用 x64 标志编译.但是,我们有大量用 FORTRAN 90 编写的 DLL 编译为 32 位.FORTRAN DLL 中的函数相当简单:你放入数据,你取出数据;没有任何状态.我们也没有在那里花很多时间,总共可能有 3%,但它执行的计算逻辑是无价的.
I have an application that we're trying to migrate to 64bit from 32bit. It's .NET, compiled using the x64 flags. However, we have a large number of DLLs written in FORTRAN 90 compiled for 32bit. The functions in the FORTRAN DLLs are fairly simple: you put data in, you pull data out; no state of any sort. We also don't spend a lot of time there, a total of maybe 3%, but the calculation logic it performs is invaluable.
我可以以某种方式从 64 位代码调用 32 位 DLL 吗?MSDN 建议我不能,期间.我做了一些简单的黑客攻击并验证了这一点.一切都会抛出一个无效的入口点异常.到目前为止,我发现的唯一可能的解决方案是为所有 32 位 DLL 函数创建 COM+ 包装器并从 64 位进程调用 COM.这看起来很头疼.我们也可以在 WoW 仿真中运行该进程,但是内存上限不会增加,上限在 1.6GB 左右.
Can I somehow call the 32bit DLLs from 64bit code? MSDN suggests that I can't, period. I've done some simple hacking and verified this. Everything throws an invalid entry point exception. The only possible solution i've found so far is to create COM+ wrappers for all of the 32bit DLL functions and invoke COM from the 64bit process. This seems like quite a headache. We can also run the process in WoW emulation, but then the memory ceiling wouldn't be increased, capping at around 1.6gb.
有没有其他方法可以从 64 位 CLR 进程调用 32 位 DLL?
Is there any other way to call the 32bit DLLs from a 64bit CLR process?
推荐答案
您需要将 32 位 dll 加载到单独的 32 位进程中,并让您的 64 位进程通过进程间通信与其进行通信.我不认为有任何方法可以将 32 位 dll 加载到 64 位进程中.
You'll need to have the 32-bit dll loaded into a separate 32-bit process, and have your 64 bit process communicate with it via interprocess communication. I don't think there is any way a 32-bit dll can be loaded into a 64 bit process otherwise.
这里有一篇很好的文章:
There is a pretty good article here:
这篇关于从 64 位进程调用 32 位代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!