What's the difference between .lib and .a files?

Nantucket picture Nantucket · Feb 25, 2010 · Viewed 53.3k times · Source

I'm trying to statically compile something and I'm trying to get a handle on what all these dependencies are. I know that .dll files are for dynamically linked dependencies that will be required by the final output, but what are .a and .lib files and when do you need each of those?

Answer

crazyscot picture crazyscot · Feb 25, 2010

.a is an archive of code: compiled but not linked. You would link statically with it during your program's final link step.

.lib can be either the same as .a, or a magical so-called "import library": a thin placeholder which causes you to require a .dll at runtime.