64到32位Interop - 怎么样? [英] 64 to 32 bit Interop - how?
问题描述
我需要将一些传统的32位代码(我没有源代码)集成到项目中,以便可以从64位.NET程序集中调用。原始代码实现为DLL中的32位COM对象。 Windows不允许从64到32位对象的直接调用,所以我正在寻找如何处理这种情况的灵感。
I need to integrate some legacy 32-bit code - for which I don't have the source code, into a project in such a way that it can be called from a 64-bit .NET assembly. The original code is implemented as a 32-bit COM object in a DLL. Windows doesn't allow direct calls from 64 to 32-bit objects, so I'm looking for inspiration on how to deal with this situation.
如何可以遗留32位COM对象是从64位.NET程序集访问的?
How can a legacy 32-bit COM object be accessed from a 64-bit .NET assembly?
更新:我们发现COM组件本身是一个ANSI C的包装,我们founf原来的源。我们能够在Visual Studio中将其编译为原生的64位dll,并将其导入.NET - 抱歉移动目标。
UPDATE: We discovered that the COM component was itself a wrapper around some ANSI C, which we founf the original source for. We were able to compile that in Visual Studio as a native 64-bit dll, and import that into .NET - sorry to move the goalposts!
推荐答案
最好的办法是使一个进程外的COM服务器包装你的32位DLL。然后,您可以从64位代码调用此代码。
The best approach is to make an out of process COM server that wraps your 32-bit DLL. You can then call this from 64bit code.
这篇关于64到32位Interop - 怎么样?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!