zaharpopov
zaharpopov

Reputation: 17272

know if .lib is static or import

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?

Upvotes: 75

Views: 19028

Answers (2)

bmargulies
bmargulies

Reputation: 100013

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

lib /list foo.lib

will do it.

Also see:

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

Upvotes: 96

engf-010
engf-010

Reputation: 3929

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.

Upvotes: 3

Related Questions