LoadLibrary() fails with error code 193.

Hello there,

I seem to have a problem with loading a 64bit DLL using a 64bit console application. After hours searching for some clue's, I haven't found anything that helps.

I'm using Microsoft Visual Studio 2010 in this case, for both the x64 DLL and x64 console application. I know that you can't load 32bit DLL's into 64bit applications and vice versa, but this seems a little strange to me. That's why I need some help on this matter.

The error code 193 (GetLastError()), seems to have the message: "not a valid Win32 application" according to msdn.

I'm using Windows 7 Ultimate x64.
(I can load the exact same DLL under x86 mode just fine using a x86 application)
The error message is accurate: The module could not be interpreted as valid. But you seem to have the answer to your question already: You say you can load the DLL using a 32-bit version of the console application. That can only mean that the DLL is 32-bit too.

Are you making sure you are recompiling the DLL as 64 bits when you switch your console application to 64 bits?
Yes, I am pretty sure the DLL is 64bits, unless Dependency Walker (x64) and Visual Studio give me wrong info. Windows also recognizes the console application as 64bits. I've tried to play around with the manifest file (DLL) to see if setting the processorArchitecture to "amd64" or "*" helps, but it doesn't.

Edit:
Forgot to mention that this only happens on another machine, not on which both the DLL and Application were made. But I don't see that there can be anything wrong with that. The other machine is also running on Windows 7 Ultimate x64.

Any help is appreciated.
Last edited on
Seems like it loaded the wrong version of msvcp100.dll (x32). Anyways it's solved.
Topic archived. No new replies allowed.