Search code examples
c++cvisual-c++msvcrt

Detect if a .lib was built against debug MSVCRT


The subject says it - is there a reliable way to detect if a .lib static library (and a dynamic library also, if possible) was built against the debug version of MSVCRT? E.g. is there any import symbol that can be used to detect that? Basically I have an app that uses tons of dependency static libs, and at least one of them needs the debug msvcrt, because the resulting executable needs both versions of the runtime.


Solution

  • for dll we can use depends Dependency Walker, if the dll depends on the MSVCRxxD.DLL it is linked with debug runtime. For more information see Use Run-Time Library.

    If you have cygwin you can run for example

    strings xxx.lib | grep MSVCRT

    or

    strings xxx.dll | grep MSVCRT

    and see if the D version appears