【问题标题】:How do certain Windows DLL apparently manage to support both 32 and 64 bit?某些 Windows DLL 显然如何同时支持 32 位和 64 位?
【发布时间】:2018-03-17 18:44:30
【问题描述】:

我似乎能够从 32 位或 64 位应用程序访问 C:\WINDOWS\system32\opengl32.dll(以及 C:\WINDOWS\system32\glu32.dll)中的函数(对于它的价值,我正在从单独的 32-位和 64 位 Python 2.7 解释器,通过 ctypes 模块)。

有了glut32.dll,情况就不同了。它只是作为 GraphViz 的 32 位安装的一部分出现在我的 Path 上。在 32 位 Python 中,我可以动态链接到它,但在 64 位 Python 中,我会得到 [Error 193] %1 is not a valid Win32 application

现在,这个错误并不让我感到惊讶,因为我一直认为 DLL 必须提交到 Windows 上的一种或另一种架构(特别是,this recent question and its answers 似乎这样说)。令我惊讶的是第一种情况下缺少错误...opengl32.dll 是如何做到的,在构建自己的 DLL 时如何复制这种行为?

【问题讨论】:

标签: windows dll 32bit-64bit


【解决方案1】:

在 64 位系统上,只有 64 位进程使用c:\Windows\System32\opengl32.dll。对于 32 位进程,系统会将 c:\Windows\System32\opengl32.dll 重定向到 c:\Windows\SysWOW64\opengl32.dll

File System Redirector

在大多数情况下,每当 32 位应用程序尝试访问 %windir%\System32 时,访问都会重定向到 %windir%\SysWOW64。对 %windir%\lastgood\system32 的访问被重定向到 %windir%\lastgood\SysWOW64。对 %windir%\regedit.exe 的访问被重定向到 %windir%\SysWOW64\regedit.exe。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-03-20
    • 2011-09-11
    • 1970-01-01
    • 2012-05-12
    • 1970-01-01
    • 1970-01-01
    • 2013-06-11
    相关资源
    最近更新 更多