简体   繁体   English

是否有可能强制在32位进程中运行.NET dll以像64位进程一样“行动”?

[英]Is it possible to force a .NET dll running in a 32 bit process to 'act' like a 64 bit process?

I am almost sure this isn't possible but it's worth an ask... 我几乎可以肯定这是不可能的,但值得一提......

We have a .NET DLL that is being called from our VB6 application. 我们有一个从我们的VB6应用程序调用的.NET DLL。 The VB6 app runs in a 32 bit process so the DLL runs in the same process (it's compiled as any cpu) Therefore when I do my ODBC Database access in the DLL is will only use a 32 bit driver, as this is what it thinks it needs (for the record the DB is Pervasive PSQL) VB6应用程序以32位进程运行,因此DLL在同一进程中运行(它被编译为任何cpu)因此,当我在DLL中进行ODBC数据库访问时,将仅使用32位驱动程序,因为这是它的想法它需要(记录数据库是Pervasive PSQL)

My problem arises when the application runs on a 64 bit machine (when only the 64 bit ODBC driver is installed) as it can't find a suitable driver to use. 当应用程序在64位计算机上运行时(当只安装64位ODBC驱动程序时),因为找不到合适的驱动程序,我的问题就出现了。

So is there a way to force the .NET DLL to run in a 64 bit process (compiling as x64 doesn't work because register for COM Interop is not allowed) 那么有没有办法强制.NET DLL在64位进程中运行(编译为x64不起作用,因为不允许注册COM Interop)

This isn't necessarily an issue at this point in time because I can install the 32 bit driver, but at some point in the future I can imagine that 32 bit driver may not be available so I will be up the proverbial creek. 这不一定是目前的问题,因为我可以安装32位驱动程序,但在未来的某个时刻,我可以想象32位驱动程序可能无法使用,所以我将成为众所周知的小溪。

No there's no way for any 32 bit process to behave as if it were a 64 bit one. 否则任何32位进程都无法像64位进程那样运行。 The best way I can think of to accomplish this is to use 2 process's. 我能想到的最好的方法是使用2个进程。

  1. The VB6 application which is running in 32 bit mode and loading your DLL VB6应用程序以32位模式运行并加载DLL
  2. A 64 bit process which actually accesses the driver. 实际访问驱动程序的64位进程。

It's possible to communicate between 32 and 64 bit processes using a number of different options: WCF comes to mind here. 使用许多不同的选项可以在32位和64位进程之间进行通信:WCF在这里可以想到。

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

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