windows 64 位 EXE 可以链接到 32 位 DLL 吗?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1116265/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 06:34:22  来源:igfitidea点击:

Can a 64 bit EXE link against 32-bit DLLs?

windows64-bitdll

提问by Assaf Lavie

I ask because I noticed that many 64 bit EXEs link against what appear to be 32-bit DLLs.

我问是因为我注意到许多 64 位 EXE 链接到似乎是 32 位 DLL 的东西。

For example, my 64 bit MFC app links against user32.dll, urlmon.dll, wininet.dll- all of which are 32 bit DLLs that reside in windows\system32.

例如,我的 64 位 MFC 应用程序链接到user32.dll, urlmon.dll, wininet.dll- 所有这些都是驻留在 windows\system32 中的 32 位 DLL。

So is this some MS specific wizardry that applies to these DLLs, or is there backward compatability, as it were, for 64 bit EXEs that need to use legacy 32 bit DLLs?

那么,这是一些适用于这些 DLL 的特定于 MS 的魔法吗,或者对于需要使用传统 32 位 DLL 的 64 位 EXE 是否存在向后兼容性?

回答by Curt Hagenlocher

You cannot link 64-bit EXEs to 32-bit DLLs or vice versa. On a 64-bit Windows OS, the DLLs in Windows\System32 are actually 64-bit DLLs. The 32-bit versions are in Windows\SysWow64.

您不能将 64 位 EXE 链接到 32 位 DLL,反之亦然。在 64 位 Windows 操作系统上,Windows\System32 中的 DLL 实际上是 64 位 DLL。32 位版本位于 Windows\SysWow64 中。

回答by Sheldon

Call 32 from 64, Sure It can. (In windows this is called WOW wich means Windows on Windows). But, viceversa It doesn't work.

从 64 拨打 32,当然可以。(在 Windows 中,这称为 WOW,意思是 Windows 上的 Windows)。但是,反之亦然。

Here you have the explanation of how:

在这里,您可以解释如何:

http://blog.mattmags.com/2007/06/30/accessing-32-bit-dlls-from-64-bit-code/

http://blog.mattmags.com/2007/06/30/accessing-32-bit-dlls-from-64-bit-code/

Hope it serves.

希望它有用。

回答by Some Guy

The latest version of Dependency Walker (found here: http://www.dependencywalker.com/) fixes this issue. It finds the correct DLLs, and avoids the inaccurate errors.

最新版本的 Dependency Walker(可在此处找到:http: //www.dependencywalker.com/)修复了此问题。它会找到正确的 DLL,并避免不准确的错误。

(I'm late to the party, but google still found this question when I had a similar problem.)

(我迟到了,但当我遇到类似问题时,谷歌仍然发现了这个问题。)