正在加载哪个版本的 C 运行时库 (CRT)?
我有一个错误,我怀疑可能是由于两台运行 Windows 7 的计算机上加载的 CRT 版本不同而导致的。如何确定正在加载 Winsxs 文件夹中的 MSVCR90.dll 的哪个版本?
我的程序是一个被另一个 EXE 加载的 DLL。它是使用 Visual Studio 2008 SP1 编译的。
I have an error that I suspect might be caused by different versions of the CRT being loaded on two computers running Windows 7. How do I determine which version of MSVCR90.dll in the winsxs folder is being loaded?
My program is a DLL being loaded by another EXE. It is compiled using Visual Studio 2008 SP1.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
正如 Al Kepp 回答的那样,您可以使用 Dependency Walker“Depends.exe”。对于动态加载的 DLL,最好的方法是在应用程序加载库时对其进行分析。
在 Dependency Walker 中打开 EXE,而不是您的 DLL。然后单击“配置文件-->开始配置文件”。如果应用程序需要参数,您可以在打开的窗口中提供它们,否则只需单击“确定”即可启动程序。程序打开后,以正常方式使用它,以便它加载您的 DLL。现在您的 DLL 已加载,您应该能够浏览 Dependency Walker 中的树以查看正在使用哪些版本的 CRT。
如果您看不到版本,请通过单击“C:\”按钮确保完整路径显示在树中。
您还可以通过检查清单来了解应用程序或库正在请求哪个版本的 CRT,清单通常但并不总是包含在 DLL 或 EXE 中。在 Visual Studio 中,单击“文件->打开->文件...”并选择 EXE 或 DLL。打开 RT_MANIFEST 资源,您应该会看到一些 XML,其中列出了 CRT 作为依赖项和版本。
As Al Kepp answered, you can use Dependency Walker, "Depends.exe". For DLLs that are dynamically loaded, the best way is to profile the application as it loads your library.
In Dependency Walker open the EXE, not your DLL. Then click "Profile-->Start Profiling". If the application requires arguments you can provide them in the window that opens, otherwise just click "Ok" to launch the program. Once the program is open, use it in the normal way so that it loads your DLL. Now that your DLL is loaded, you should be able to browse the tree in Dependency Walker to see which versions of the CRT are being used.
If you can't see the version, ensure that the full paths are shown in the tree by clicking the "C:\" button.
You can also see which version of the CRT the application or library is requesting by checking the manifest, which is generally, but not always included in the DLL or EXE. in Visual Studio, click "File->Open->File..." and select the EXE or DLL. Open the RT_MANIFEST resource and you should see some XML which lists the CRT as a dependency and the version.
大多数在 DLL 文件中使用这些语言库的应用程序仅使用 Windows 目录中这些 DLL 的最新版本。如果您出于某种原因需要某些特定版本,最简单的方法可能是将这些正确的文件放入与您的 exe 相同的目录中。
您可以使用 Dependency Walker 应用程序来查看哪些 DLL 文件在启动时加载到您的进程中。您可以从 Microsoft 网站免费下载它。
Most applications using these language libraries in DLL files use simply the latest version of those DLL in Windows directory. If you for some reason need some specific version, the easiest what you can do is probably to put those correct files to the same directory as your exe.
You can use Dependency Walker application to see which DLL files are loaded into your process on startup. You can download it from Microsoft site for free.