Walking Corpse
Walking Corpse

Reputation: 73

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

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 getting 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.

Upvotes: 4

Views: 4145

Answers (3)

Jayesh
Jayesh

Reputation: 1523

  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

Upvotes: 1

Alex F
Alex F

Reputation: 43311

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.

Upvotes: 0

Ozair Kafray
Ozair Kafray

Reputation: 13539

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

Upvotes: 0

Related Questions