I'm writing an add-in for an application which runs in 64 bit, however I need to use objects from a 32 bit library (this library only comes in 32 bit). Is there any way I can accomplish this?
我正在为64位运行的应用程序编写一个加载项,但是我需要使用32位库中的对象(这个库只有32位)。有什么方法可以做到这一点吗?
2 个解决方案
#1
8
This is quite easy in .NET. You just need all modules in a process to be the same bit-width.
这在.NET中很容易。您只需要一个进程中的所有模块具有相同的位宽。
So you simply start a child 32bit process, put all 32bit DLLs there, and use remoting features of .net to call procedures in it. Or as used to say in COM-times: Use out-of-process component server.
因此,您只需启动一个32位子进程,将所有32位DLL放在那里,并使用.net的远程处理功能来调用其中的程序。或者像在COM-times中所说:使用进程外组件服务器。
It will get more complicated when you need to pass a lot of data between 32bit and 64bit modules. You can setup memory-sharing, but it requires more work than normal.
当您需要在32位和64位模块之间传递大量数据时,它会变得更加复杂。您可以设置内存共享,但它需要比平时更多的工作。
#2
7
The rule here is simple, but not what you want to hear. All code in a single process has to have the same bit-ness. If your hosting process is 64 bit then all code in that process must be 64 bit also. Hence, if you need to run 32 bit code, you must put the 32 bit code in a separate process and use some form of IPC.
这里的规则很简单,但不是你想要听到的。单个进程中的所有代码必须具有相同的位。如果您的托管进程是64位,那么该进程中的所有代码也必须是64位。因此,如果需要运行32位代码,则必须将32位代码放在单独的进程中并使用某种形式的IPC。
#1
8
This is quite easy in .NET. You just need all modules in a process to be the same bit-width.
这在.NET中很容易。您只需要一个进程中的所有模块具有相同的位宽。
So you simply start a child 32bit process, put all 32bit DLLs there, and use remoting features of .net to call procedures in it. Or as used to say in COM-times: Use out-of-process component server.
因此,您只需启动一个32位子进程,将所有32位DLL放在那里,并使用.net的远程处理功能来调用其中的程序。或者像在COM-times中所说:使用进程外组件服务器。
It will get more complicated when you need to pass a lot of data between 32bit and 64bit modules. You can setup memory-sharing, but it requires more work than normal.
当您需要在32位和64位模块之间传递大量数据时,它会变得更加复杂。您可以设置内存共享,但它需要比平时更多的工作。
#2
7
The rule here is simple, but not what you want to hear. All code in a single process has to have the same bit-ness. If your hosting process is 64 bit then all code in that process must be 64 bit also. Hence, if you need to run 32 bit code, you must put the 32 bit code in a separate process and use some form of IPC.
这里的规则很简单,但不是你想要听到的。单个进程中的所有代码必须具有相同的位。如果您的托管进程是64位,那么该进程中的所有代码也必须是64位。因此,如果需要运行32位代码,则必须将32位代码放在单独的进程中并使用某种形式的IPC。