编译 0K 时,x64 系统上的 win32 应用程序的运行时错误(dll 加载) [英] Runtime error (dll loading) with win32 applications on x64 system, while compiling 0K

查看:16
本文介绍了编译 0K 时,x64 系统上的 win32 应用程序的运行时错误(dll 加载)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最初在win7 32位上设计了一个win32应用程序,用VC9.0.最近升级到win7 64位,尝试构建+执行之前的应用.

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.

构建运行良好(win32 应用程序),但在运行时出现错误[...] 已退出,代码为 -1073741701 (0xc000007b)."

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

我猜这是加载 [预期] 32 位 dll 的 64 位版本的结果.

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

此项目的特定依赖项是:文件库SDLmain.libSDL_ttf.libopengl32.libglu32.libwininet.lib

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

SDL 和 SDL_ttf 只有 32 位版本.我假设 Visual Studio 足够聪明,可以在我请求 win32 应用程序时获取 syswow64 中的 opengl 和 glu 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.

会不会是因为wininet?还是我做错了?

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

谢谢,

推荐答案

您似乎正在将 64 位 DLL 加载到 32 位进程中,反之亦然.下面是我将如何追踪有问题的 DLL.

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.

第一步是在可执行文件上运行 dumpbin.exe(使用 VS 命令提示符将其放在 PATH 上)以确保架构符合您的预期:dumpbin.exe/headers foo.exe.在文件头输出中,您应该看到机器"值x86"或x64".在可选的标头输出中,您应该看到PE32"(适用于 x86)或PE32+"(适用于 x64).

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).

下一步是根据架构(x86 或 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.

如果 Dependency walker 发现问题,那么修复方法是用相同架构的库替换有问题的库,或者确保根据搜索路径将正确的库定位在不正确的库之前.

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.

这篇关于编译 0K 时,x64 系统上的 win32 应用程序的运行时错误(dll 加载)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆