在 64 位机器上注册 C++ DLL

Registering C++ DLL on 64-bit machine

我编写的 C++ DLL 无法在 64 位计算机上注册。请注意 32 位计算机上 DLL 寄存器的 32 位版本。

我们在 64 位 Windows 7 计算机上使用 Visual Studio 2010 发布模式构建 DLL,并针对 x64 平台。我想在 64 位 Windows10 计算机(目标)上安装 DLL。目标计算机安装了 64 位的 VS 2010 redist。当我尝试使用以下方式注册程序时:

C:\windows\system32\regsvr32.exe

它失败并表示程序 "may not be compatible with this version of Windows that you're running. Check if the module is compatible with an x86 (32-bit) or x64 (64-bit) version of regsvr32.exe"。

我使用名为 Dependencies 的程序来尝试找出 DLL 需要哪些依赖项。依赖项说我的 DLL 需要 ATL100.dll。但是,这是由 VS 2010 redist 安装的,确实位于 C:\windows\system32。 DLL本身不依赖于任何第三方程序。

有没有人知道接下来要寻找什么来注册这个文件?

我明白了。我不得不卸载 64 位和 32 位 VS 2010 redist。删除 C:\windows\system32 和 syswow64 目录中的 ATL100.dll 并重新启动计算机。重新启动后,我重新安装了两个 redist 安装程序。然后我能够从管理命令提示符注册文件。

也许我们安装的东西安装了 ATL100.dll 文件,当我安装 64 位 redist 时它没有覆盖 ATL100.dll。保留已安装的过时版本。