开发者

Microsoft Visual Studio: How to find where a dll is loaded from?

开发者 https://www.devze.com 2023-03-14 13:17 出处:网络
A wrong version of a dll (MSVCR90d.dll instead of MSVCR90.dll) gets used for the delete operator, causing a crash. In the callstack, only the dll name is shown, not their path. How to see the path?

A wrong version of a dll (MSVCR90d.dll instead of MSVCR90.dll) gets used for the delete operator, causing a crash. In the callstack, only the dll name is shown, not their path. How to see the path?

Edit: I'm building in Release mode, not in debug mode. So why does the debug dll get used? I have seen the same problem reported on many other websites, but could find no working solution. Yesterday I found using Dependency Walker that the debug dll is ge开发者_如何学运维tting picked up, so I renamed the dll, then the release version got picked up in the Dependency Walker, and also my program did not crash. I didn't change anything today, but the program has started crashing again. And when I see the dependency walker tree, it shows MSVCR90d.dll (the debug dll) with a question mark, saying it couldn't find it in the path. Why can't it pick up the release dll? Also I don't know from where the debug dll gets used by the runtime.


  1. You can add them in your global PATH environment variable. Refer here
  2. You can specify the dll manually by right clicking on the solution and selecting Add Reference, then browse to the particular dll.
  3. You can add the path to the DLLs to the Executables files settings under Tools > Options > Projects and Solutions > VC++ Directories


For finding out the details of a dll, you might want to use DependencyWalker

However, in your case I think d is being appended to the name of dll, probably because you are creating a DEBUG build, and for that corresponding DEBUG versions of all dlls are loaded.

If you choose to create a RELEASE build, you would not have a d appended to MSVCR90.dll


You don't need to know Dll path, you need to understand why Debug version of delete operator is called. Maybe, _DEBUG constant is defined in Release configuration.

0

精彩评论

暂无评论...
验证码 换一张
取 消