32-bit dll in a 64-bit application in C #

Hello
I want to create a 64-bit application in C # and I will not use the dll created in C ++ builder (32 bit) in it. But when I try to load the DLL, the application crashes. When building in 32bit, it works. Is there a way to use this DLL in a 64-bit application?

+6
c # 64bit dll
source share
3 answers

No, It is Immpossible. The process on Windows is 32 or 64 bit, and it can only load DLLs that match. Any attempt to load a DLL that does not match will fail and result in an error.

If you need to map 32 and 64 bit code, you need to use several processes. In this case, although I would just make the application a 32-bit or 64-bit DLL file

+8
source share

Do you want to create a 64-bit application or want to create an application that will work in a 64-bit environment? An application can work perfectly in a 64-bit environment, even if the target platform is x86.

+1
source share

You cannot load a 32-bit DLL into a 64-bit process on Windows.

I have never tried this on my own, but you could create a separate 32-bit application that can work in another process and act as a proxy for the DLL. Then your application can run 64-bit and interact with the DLL with remote procedure calls through WCF.

If performance is a concern, the best option would be to rebuild the DLL in the 64-bit version, if possible.

0
source share

All Articles