know if .lib is static or import

C++CWindowsDll

C++ Problem Overview


I have .lib file compiled from C code. How I know if this self-contained static library or just an import lib and DLL will be needed at runtime? Is there some dumpbin option I'm missing?

C++ Solutions


Solution 1 - C++

Use the lib command. If it's static, lib will show you a pile of .obj files inside. Not so if it's am implib.

lib /list foo.lib

will do it.

Also see:

https://docs.microsoft.com/en-us/cpp/build/reference/managing-a-library

Solution 2 - C++

Look in its accompanying header files ,if the function are 'decorated' with __declspec(dllimport) that it's an import library. Or look for an accompanying .def file ,that also tells you that it's an import library.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionzaharpopovView Question on Stackoverflow
Solution 1 - C++bmarguliesView Answer on Stackoverflow
Solution 2 - C++engf-010View Answer on Stackoverflow