views:

205

answers:

3

Just doing a little work this morning making some static libraries and wanted to know why static libraries end with '.a'. No one in my office knew so I thought I would ask around on SO. We are writing code in C++/C/Obj-C

+7  A: 

That's just a convention on unix-based systems. Visual Studio (windows) generate .lib files.

In fact I just discovered that there are several other namings : http://en.wikipedia.org/wiki/Library_(computing)#Naming

Klaim
I would be curious to know the history behind this convention. I wonder if it's documented anywhere?
Mark Ransom
I thought it might stand for something. Must have been a grad student that thought it was a good idea to give it a one letter extension lol
Shadow
Yeah I added the link to wikipedia, that's interesting.
Klaim
+14  A: 

I think the .a convention comes from using an "archiver" to place the object files into a static library.

GWW
+4  A: 

It's an archive format (think of .zip or .tar) containing .o object files generated by "ar". The linker just treats it as if the object files were specified individually.

MarkR
If you specified the .o file individually the linker might include them even if none of their symbols were specified, but with .a files linkers usually only bring in .o files within the archive who are required to satisfy the object being built.
nategoose