static library v.s. import library on Windows platform

妖精的绣舞 提交于 2019-12-03 12:31:05

Import library will add a DLL dependency to your program. Your program won't start, if you don't have the DLL. (You may use Dependency Walker to get the names of the DLL's of your program depend on).

Afaik Static libraries do not have dependencies. They linked into the program, only linker errors will tell you if that particular library depends on another lib. (At least in GCC, I don't know want is the behaviors of the MS tools.)

Given only a wtf.lib file, the question is to determine wither this library file is a static library or an import library. The current way I do this is (via a combination of DOS prompt and a cygwin bash shell).

In DOS prompt needed to correctly run dumpbin.exe:

dumpbin -all wtf.lib > wtf.lib.txt

Then, in cygwin shell:

grep 'Archive member name' wtf.lib.txt

If the output of grep spits out a DLL filename, then wtf.lib is an import library. Else, it is a stand-alone static library.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!