views:

89

answers:

2

Just now I found that static libraries in *nix systems, in other words *.a libraries are nothing but archives of relocatables(*.o files) in ar fromat.

  1. What about static libraries(*.lib files) in windows? Which format are they in?

  2. I found an article: http://www.microsoft.com/msj/0498/hood0498.aspx which explains *.lib file structure. But Where can I find "Official" specifications of *.lib file structure/format?

  3. Other than ar.exe of mingw is there any tool from Microsoft which extracts relocatable objects of *.lib & *.a files?

EDIT:

I wonder why I'm unable to get to this question. If there are no official specifications. Then how does the compiler ('linker' to be more correct) writers work with *.LIB files?

+1  A: 

mingw's ar works just fine on *.lib files - even ones created under VisualStudio.

We've actually used it in the past to pull out parts of a library we needed when it contained some other stuff we couldn't link with (due to conflicts with other libraries). Kinda hacky, but it works.

T.E.D.
Thats a useful piece of info. But does this mean that *.lib files are also in `ar` format? May be, mingw's ar.exe is abstracting the underlying format and behaving in the same way.
claws
Don't really know. I was mostly answering #3 I guess.
T.E.D.
+1  A: 

I found that *.LIB file also use ar file format.

Official Specifications: Section 7. "Archive (Library) File Format" of Microsoft Portable Executable and Common Object File Format Specification describes this format.

claws