visual studio - Find out whether a lib requires static or dynamic runtimes -
whenever link static libraries visual c++ project have create sure value runtime library of project matches value used compile library. if illustration library compiled alternative static runtimes , seek compile project dynamic runtimes linker throw error.
obviously linker has way of determining whether library compiled static or dynamic runtimes. wondering if there command line tool takes library , can straight tell me runtimes used during creation?
dumpbin /directives
friend:
c:\jm>type 08.cpp int main() { } c:\jm>cl /nologo /c /mt 08.cpp 08.cpp c:\jm>dumpbin /nologo /directives 08.obj dump of file 08.obj file type: coff object linker directives ----------------- /defaultlib:libcmt /defaultlib:oldnames summary 60 .debug$s 2f .drectve 7 .text$mn c:\jm>
note /defaultlib:libcmt
under "linker directives." linker directive injected object when compile /mt
(static release crt). /mt
, /mtd
, /md
, , /mdd
linker options cause different runtime libraries dragged in. see the documentation details.
a library collection of objects, can utilize dumpbin /directives
on lib file directives contained in each object in library. note it's possible (though quite uncommon) different objects in single static library compiled different runtime library options.
visual-studio visual-c++ static-libraries
No comments:
Post a Comment