Runtime error (dll loading) with win32 applications on x64 system, while compiling 0K

无人久伴 提交于 2019-12-19 08:18:05

问题


I originally designed a win32 application on win7 32bits, with VC9.0. I recently upgraded to win7 64 bits, and tried to build+execute the previous application.

Building runs fine (win32 application), but on runtime I get the error "[...] has exited with code -1073741701 (0xc000007b)."

I guess this results of the loading of a 64bits version of an [intended] 32bits dll.

Specific dependencies for this project are: SDL.lib SDLmain.lib SDL_ttf.lib opengl32.lib glu32.lib wininet.lib

SDL and SDL_ttf are only in 32bits version. I assume that Visual Studio is clever enough to fetch the opengl and glu lib files in \syswow64 as I request a win32 application.

Could it be because of wininet? Or did I make a mistake?

Thanks,


回答1:


It appears you are loading a 64-bit DLL into a 32-bit process or vice versa. Here's how I would go about tracking down the offending DLL.

The first step is to run dumpbin.exe (use a VS command prompt to get it on the PATH) on the executable to ensure the architecture is what you expect: dumpbin.exe /headers foo.exe. In the file header output, you should see a "machine" value of "x86" or "x64". In the optional header output, you should see a magic of "PE32" (for x86) or "PE32+" (for x64).

The next step is to run the appropriate dependency walker, available at www.dependencywalker.com, depending on the architecture (x86 or x64) of the executable. This tool should tell you if it locates a dependency on the search paths that is not of the same architecture.

If dependency walker finds a problem, the fix would then be to replace the offending library with a library of the same architecture or ensure the correct library is located before the incorrect library based on search paths.



来源:https://stackoverflow.com/questions/5372565/runtime-error-dll-loading-with-win32-applications-on-x64-system-while-compili

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!