slhck
slhck

Reputation: 38662

Why is my release build still looking for a debug DLL (MSVCR110D.dll)?

I have a similar issue to this question. I'm building a DLL that's dependent on several other DLLs. Naturally, everything works when compiled in debug mode, on the machine where VS2012 is installed. I've then started to compile all dependencies in release mode, creating the release DLLs.

When I deploy them on a fresh Windows 7 machine with the Visual C++ Runtime installed, the main DLL doesn't load because it still asks for MSVCR110D.dll.

DependencyWalker shows me this (sorry for the censoring, I can't show the names, but I left the r suffix for release mode builds):

As you can see, it references the release version of the Visual C++ runtime. Even going down the entire tree of dependent DLLs, there are only references to the release runtime DLLs:

There is one delayed-loaded DLL that references MSVCR80.dll, but it's never actually loaded in practice, and that's also not the error I'm getting.

The question is: How do I find out why it still depends on the debug runtime? Which DLL, which function call is responsible for that? What tools and what steps can I use to track it down, if not through DependencyWalker?

Upvotes: 2

Views: 4215

Answers (1)

slhck
slhck

Reputation: 38662

I've found that DependencyWalker did not show the correct dependents. What worked was using the Visual Studio Command Prompt and the dumpbin program:

dumpbin /dependents YourDLL.dll

This will list all dependents, and from there you can go down the tree. I eventually found the culprit—a dependent DLL that referenced MSVCRd.dll, which was not shown in DependencyWalker.

Dump of file XXXXXXXr.dll

File Type: DLL

  Image has the following dependencies:

    AVIFIL32.dll
    MSVCR110D.dll   <------------------------ HERE
    WMVCore.DLL
    WINMM.dll
    KERNEL32.dll
    USER32.dll
    ole32.dll
    OLEAUT32.dll
    MSVCP110.dll

  Summary

        9000 .data
       12000 .rdata
        5000 .reloc
        1000 .rsrc
       48000 .text

I then had to go to the build configuration for this DLL and change the dependency on msvcrd.lib to msvcr.lib in the Linker options.

Upvotes: 5

Related Questions