PInvoke with 32 bit native Dll in windows 7 64 bit
-
What is the problem to run in windows 7 64 bit C# application (compiled on Vista 32 bit VS2008 .NET 3.5) which uses PInvoke to run native function from 32 bit Dll. Exception is System.BadImageFormatException Attempt to load application having bad format (HRESULT: 0x8007000B)
Чесноков
-
What is the problem to run in windows 7 64 bit C# application (compiled on Vista 32 bit VS2008 .NET 3.5) which uses PInvoke to run native function from 32 bit Dll. Exception is System.BadImageFormatException Attempt to load application having bad format (HRESULT: 0x8007000B)
Чесноков
-
What is the problem to run in windows 7 64 bit C# application (compiled on Vista 32 bit VS2008 .NET 3.5) which uses PInvoke to run native function from 32 bit Dll. Exception is System.BadImageFormatException Attempt to load application having bad format (HRESULT: 0x8007000B)
Чесноков
As Covean said, you can't use a 32bit dll form a 64bit application. By default, a .NET application run according to the O.S. (so, in a 64bit systems run as 64bit application). You have to force your application to run as 32bit by changing the "Platfor Target" value in the Build properties of your Visual Studio Project.
-
What is the problem to run in windows 7 64 bit C# application (compiled on Vista 32 bit VS2008 .NET 3.5) which uses PInvoke to run native function from 32 bit Dll. Exception is System.BadImageFormatException Attempt to load application having bad format (HRESULT: 0x8007000B)
Чесноков
If you have a 64 bit .NET application attempting to run a 32 bit DLL, you can change it to run in 32 bit mode by using the corflags command. It's detailed here[^], but basically you need to run
corflags myassembly.exe /32bit+
"WPF has many lovers. It's a veritable porn star!" - Josh Smith
As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
-
If you have a 64 bit .NET application attempting to run a 32 bit DLL, you can change it to run in 32 bit mode by using the corflags command. It's detailed here[^], but basically you need to run
corflags myassembly.exe /32bit+
"WPF has many lovers. It's a veritable porn star!" - Josh Smith
As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
that seems to be the only solution to avoid recompilation, many thanks!
Чесноков
-
that seems to be the only solution to avoid recompilation, many thanks!
Чесноков
You are welcome.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith
As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.