简体   繁体   English

在64位应用程序中使用32位interop dll

[英]Using 32 bit interop dll in 64 bit application

I am little confused about using 32 bit interop dll with 64 bit process. 我对使用32位interop dll和64位进程感到困惑。 In order to get access to 8TB of memory I am going to build my application for 64 bit, unfortunately it uses some statistical interop library which is build in 32 bit mode. 为了访问8TB的内存,我将构建我的64位应用程序,不幸的是它使用了一些以32位模式构建的统计互操作库。 I don't have sources for this library so I cannot rebuild it to 64 bit. 我没有这个库的源代码所以我无法将它重建为64位。

In this article the suggestion is to create 64 bit surrogate process that will communicate with my app using IPC (eg WCF). 文章的建议是创建64个代理程序将使用IPC(如WCF)我的应用程序进行通信。 Here we can find the solution that uses Runtime Callable Wrapper ( RCW ). 在这里,我们可以找到使用Runtime Callable Wrapper( RCW )的解决方案。 Which is better? 哪个更好? I started to implement surrogate process and just today I found the second solution which I don't know if is suitable for my needs. 我开始实施代理流程,就在今天我找到了第二个解决方案,我不知道它是否适合我的需求。

I need to mention that this statistical interop library has hundreds of interfaces and classes. 我需要提一下,这个统计互操作库有数百个接口和类。 Still I need just some of them. 我仍然需要其中一些。 I have started creating WCF service hosting several of them as endpoints and it seems it will be a lot of code/work. 我已经开始创建WCF服务托管其中几个作为端点,它似乎将是很多代码/工作。

Can I use second method (RCW) to use with interop dll? 我可以使用第二种方法(RCW)与interop dll一起使用吗?

Regards, jotbek 此致,约特贝克

Well, "better" is a loaded term. 嗯,“更好”是一个加载的术语。 But, yes, COM surrogates can make it a helluvalot simpler to get this going. 但是,是的,COM代理可以使它成为一个简单的方法来实现这一目标。 If you can use the system surrogate, odds are almost always good when the library was well designed, then you just need to duplicate the registry keys into the 64-bit keys and tweak a few of them to use the surrogate and it all works without you writing any code at all. 如果你可以使用系统代理,当库设计得很好时,几率总是好的,那么你只需要将注册表键复制到64位密钥中并调整其中一些以使用代理,这一切都可以在没有你编写任何代码。 The MSDN starting page is here . MSDN起始页面在这里

It won't work out when the library doesn't support cross apartment marshaling. 当图书馆不支持跨公寓编组时,它将无法解决。 If you have no idea if it does then try calling a library function from a worker thread. 如果您不知道是否这样做,那么尝试从工作线程调用库函数。 If that doesn't work then don't bother trying. 如果这不起作用,那么不要费心去尝试。 And you'll lose the "better" if this library is prone to crashing bugs, that invariably turns out poorly in an out-of-process scenario. 如果这个库容易崩溃,那么你将失去“更好”,这在一个进程外的场景中总是很糟糕。 Speed might be an issue, out-of-process calls have a lot of overhead. 速度可能是一个问题,进程外调用有很多开销。 But you're stuck with that either way. 但无论哪种方式,你都会坚持下去。 You'll get good answers instead of SO guesses by contacting the library owner for support. 通过联系图书馆老板寻求支持,您将获得良好的答案,而不是猜测。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM