Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

32bit dll in 64bit application in c#

Tags:

c#

dll

64-bit

Hello
I want to create a 64bit application in c# and I wan't to use in it a dll created in C++ builder (32bit). But when I try to load the dll the application crashes. When built in 32bit it works. Is there a way to use this dll in a 64bit app?

like image 368
rodro Avatar asked Mar 29 '11 21:03

rodro


2 Answers

No this is not possible. A process in Windows is either 32 or 64 bit and it can only load DLL's which match. Any attempt to load a DLL which does not match will fail and produce an error.

If you need to match 32 and 64 bit code you need to use multiple processes. In this case though I would just make the application 32 bit or the DLL 64 bit

like image 90
JaredPar Avatar answered Sep 21 '22 01:09

JaredPar


Do you want to build a 64-bit application, or you want to build an application that will run in a 64-bit environment? Your application can run perfectly fine in a 64-bit environment even when the target platform is x86.

like image 37
Joel C Avatar answered Sep 21 '22 01:09

Joel C