dumpbin /dependents
will allow you to determine whether a module (EXE or DLL) depends on the Visual C++ libraries DLLs (and which versions and flavors--debug or release--of those DLLs). For example, with Visual C++ 2013...
When you compile with /MD
, your module depends on the retail msvcr120.dll:
>cl /MD /nologo test.cpp
test.cpp
>dumpbin /dependents test.exe | findstr dll
MSVCR120.dll
KERNEL32.dll
When you compile with /MDd
, your module depends on the debug msvcr120d.dll:
>cl /MDd /nologo test.cpp
test.cpp
>dumpbin /dependents test.exe | findstr dll
MSVCR120D.dll
KERNEL32.dll
When you compile with /MT
or /MTd
, your module does not depend on any CRT DLL:
>cl /MT /nologo test.cpp
test.cpp
>dumpbin /dependents test.exe | findstr dll
KERNEL32.dll
>cl /MTd /nologo test.cpp
test.cpp
>dumpbin /dependents test.exe | findstr dll
KERNEL32.dll
When you've statically linked the Visual C++ libraries, it's generally not possible to tell whether the retail or debug libraries were linked in (in general you can't tell whether any Visual C++ libraries were linked in). If you have a PDB for your module, you can often use that to figure out what was linked in, based on source file information and functions present in the module.
(Two notes: [1] My test.cpp file was a simple C Hello, World! program. If it linked other Visual C++ libraries dynamically, dumpbin /dependents
will also report them. [2] dumpbin /dependents
works equally well with DLLs.)