Best way to call 32-bit unmanaged code from 64-bit Managed Code using a managed code wrapper

前端 未结 2 626
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-02-04 06:46

The frequency with which I am coming across the situation where I have to call native 32-bit code from a managed 64-bit process is increasing as 64-bit machines and applications

2条回答
  •  感动是毒
    2021-02-04 07:00

    Pretty much the only answer is out of process communication. You could create a .NET project that is a 32-bit executable that makes all of the 32-bit calls needed and communicate with it via Windows Messages, WCF, Named Pipes, Memory Mapped Files (4.0), etc. I am pretty sure this is how Paint.NET does their WIA (Windows Imaging Acquisition) from a 64-bit process.

    In the case of PDN, they simply pass the name of the file they expect as the output, but more complex communication isn't difficult. It could be a better way to go depending on what you're doing.

提交回复
热议问题