What's the format of .lib in windows?

wamp picture wamp · Sep 28, 2010 · Viewed 7.9k times · Source

AFAIK, .dll is in PE format, what about .lib?

Answer

jlguenego picture jlguenego · Mar 28, 2014

There is 2 kind of files with .lib extension :

  1. the static library (for static linking)
  2. The import library (for dynamic linking)

Both are an archive of COFF files. The format of this archive is an 'ar archive'.

The unix (cygwin/mingw) command ar can parse this file like the tar command does.

If you want to see the archived file in a .lib, you can do:

ar tv <name>.lib

Generally, if you see .obj file, it means that it is a static library. If you see .dll then it is an import library.