I have a C# program that I compile with all of the default settings on an x64 computer.
I want to p/invoke a DLL which I know is a 32-bit (unmanaged) C++ DLL.
I can get this to work when my C# program runs on a 32-bit machine, but not a 64-bit machine.
How can I specify in the DllImport call that I am calling into a 32-bit dll?
Example of what I have now:
[DllImport("test32bitdll.dll", SetLastError=true)]
public static extern void MyFunc();
I do not have the source code of the test32bitdll.dll file.
Running 32-bit unmanaged code in a 64-bit process is not possible. Or the reverse. The options you have available:
The 3rd option can give you the most bang for your buck but it can be slow if there's a lot of data exchanged and tends to be fragile. It can be difficult to deal with failure of the surrogate process.
实现此功能的最简单方法是更改您的exe以构建“仅限x86”。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.