64到32位的互操作 - 如何? [英] 64 to 32 bit Interop - how?

查看:181
本文介绍了64到32位的互操作 - 如何?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要整合一些旧的32位code - 要我没有源$ C ​​$ C,到项目以这样一种方式,它可以从64位.NET被称为部件。原来的code为实现为在一个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!

推荐答案

最好的办法是使出来,它包装的32位DLL进程内COM服务器。然后,您可以从64位code调用此。

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位的互操作 - 如何?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆