Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

check what run-time static library or dll uses

is there a tool in windows SDK to ckeck what CRT a library uses? for example I have a *.lib file, how do check if it's compiled with /MDd flag or /MT? also how to check the same for dll or exe? can this be done with dumpbin?

like image 944
codekiddy Avatar asked Aug 13 '14 11:08

codekiddy


1 Answers

If it is a .lib file, a static link library, then you don't know anything about the CRT yet. It wasn't linked yet. You can find out about the original programmer's intention, use a hex viewer to look the .lib file, Notepad will do fine as well. You'll see the original command line that was used to compile the .obj files that were embedded in the .lib file. Simply search for "cl.exe", you'll have a good idea what compiler version was used from the path to cl.exe. And you can see the command line options so you'll know if /MD or /MT was in effect. And the /O option, important to have an idea whether you've got a Debug or Release build.

If it is a .dll file then dumpbin.exe /imports is your best choice. The dependency on the msvcrxxx.dll file will be visible, with xxx the version number like "120". If you see it then the name tells you if /MD or /MDd was used, "d" is appended for the Debug version of the CRT If it is missing then you know that /MT or /MTd was used, no hint about the build flavor available.

Following the recommendations from the library owner is always best, you can get into a lot of trouble when the CRT version or build settings of the library doesn't match yours. With non-zero odds that you have to ask him for an update, YMMV.

like image 74
Hans Passant Avatar answered Sep 23 '22 08:09

Hans Passant