2

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.

David Robison
  • 623
  • 1
  • 10
  • 25
  • What is the problem? Do you get an error message when your app is loaded or does it not load at all? You can also check the manifest of the EXE and the DLL to see which version of the CRT they require. – Dusty Campbell Jan 21 '11 at 18:21
  • The specific problem is here, but I didn't this question to get sidetracked by those details: http://stackoverflow.com/questions/4752708/c-delete-is-slow-where-should-i-look-first – David Robison Jan 22 '11 at 11:31

2 Answers2

4

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.

Dusty Campbell
  • 3,146
  • 31
  • 34
1

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.

Al Kepp
  • 5,831
  • 2
  • 28
  • 48
  • I'm not sure if I need a specific version or not. I'm hoping to figure out which version is loading for the two computers. When I try using Dependency Walker, it gives me an "Error opening file" message on that DLL file. – David Robison Jan 25 '11 at 20:39
  • 1
    You have to open EXE file in Dependency Walker, not DLL. Then it should inform you about all DLLs statically bound to it (and show no errors). – Al Kepp Jan 25 '11 at 20:48