BadImageFormatException on framework 64 bit

G

Guest

My application uses a win32 DLL (unmanaged code) and it works well with .net
framework 32 bit. Now I'm testing it with .net framework 64 bit on a pc with
windows XP 64 bit and as soon as the application start I get this error when
the program load the win32 dll: System.BadImageFormatException: An attempt
was made to load a program with an incorrect format. (Exception from HRESULT:
0x8007000B)
I read win 32 applications work on windows XP 64 bit, so why this exception?
 
J

jacky kwok

Rudy said:
My application uses a win32 DLL (unmanaged code) and it works well with .net
framework 32 bit. Now I'm testing it with .net framework 64 bit on a pc with
windows XP 64 bit and as soon as the application start I get this error when
the program load the win32 dll: System.BadImageFormatException: An attempt
was made to load a program with an incorrect format. (Exception from HRESULT:
0x8007000B)
I read win 32 applications work on windows XP 64 bit, so why this exception?

Is your application a Dotnet2.0 application?

Do you install the 64bit dotent2.0 framework in your 64 machine XP?

If both yes, your application will run in native 64bit mode and it
cannot load any 32 bit native dll (non-dotnet dll).

You can check your application in the task manager in "Processes" tab in
64 OS. If it has no a mark "*32", it is running in 64 bit mode.

If the application is developed yourself, you can set it in the
development tools (e.g. VS2005) to mark it always running in 32 bit
mode. Then, your application can use the 32 bit dll no problem.
 
G

Guest

You can check your application in the task manager in "Processes" tab in
64 OS. If it has no a mark "*32", it is running in 64 bit mode.
If the application is developed yourself, you can set it in the
development tools (e.g. VS2005) to mark it always running in 32 bit
mode. Then, your application can use the 32 bit dll no problem.

Yes you are right, it is running in 64 bit mode.
But if I set it to run in 32 bit mode then all managed and unmanaged code
run in 32 bit mode? In other words can I take advantage from 64 bit system or
not?
Thanks!!!
 
J

jacky kwok

Rudy said:
Yes you are right, it is running in 64 bit mode.
But if I set it to run in 32 bit mode then all managed and unmanaged code
run in 32 bit mode? In other words can I take advantage from 64 bit system or
not?
Thanks!!!


In my opinion, it is dependent on your actual case.

If your 64bit OS just run only one application and the application is
32bit application, it will not take advantage from 64 bit system.

However, in most case, there are many applications running in one
computer. Hence, overall the system still can take some advantage, e.g.
the system can use more physical memory (if the computer have so much
memory).

Of cause, the best solution is to convert the 32 bit DLL to 64 bit DLL.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top