How to tell if a lib was compiled with /mt or /md?

前端 未结 2 1720
轮回少年
轮回少年 2020-12-08 04:50

Given a compiled lib, is there a way to tell if it was compiled with /md or /mt just by looking at it (maybe with dumpbin

2条回答
  •  臣服心动
    2020-12-08 05:34

    Yes, you could use dumpbin's /DIRECTIVES option to find which runtime libraries the objects in the .lib want to link with:

    dumpbin /directives foo.lib
    

    Look for instances of the runtime libraries specified here. For example, you might see:

    /DEFAULTLIB:MSVCRTD (module compiled with /MDd)

    or

    /DEFAULTLIB:MSVCRT (module compiled with /MD)

    or

    /DEFAULTLIB:LIBCMT (module compiled with /MT)

    There will probably be many /DEFAULTLIB directives, so you can search using terms like:

    dumpbin /DIRECTIVES foo.lib | find /i "msvcr"
    

    Hope this gets you on the right track.

提交回复
热议问题