How to find the cause of a debug runtime dependency in a release build

My C ++ project in VS2015 outputs a DLL file. This project depends on vagarious * .lib files. When I check the output DLL with the dependent walker, it shows that it depends on VCRUNTIME140D.DLL. But I was building the project in release mode.

So, anyway, to find what it means to tie myself to debug timing, even if I'm building a project with release mode.

+3


source to share


1 answer


In fact, you should be able to see exactly what is causing the dependency through the Dependency Walker. I created a sample solution with two projects that output DLLs. The first of the projects references the second, and the second uses a debug workbench even in release mode, so building the first dll project in release mode will output a DLL that references both release and debug time versions. This is what I get when looking at the first dll using Dependency Walker:

Dependency Walker showing both runtimes

So, as you can see, by carefully examining the list of imported libraries, you can find out which one is importing the debug version of the runtime.

EDIT

Ok, if the dependency comes from a file .lib

, then the best I can think of is:



1) Include verbose linker output like this:

Enable Verbose linker output

2) Build and view the output window to see which file is .lib

triggering the download of the junk .dll

, in my case it shows what MixedModeDll2.lib

triggers the download MSVCRTD

:

Verbose linking output example

+1


source







All Articles