Contents of a static library Contents of a static library c c

Contents of a static library


On gcc, use ar -t.

-t option of the gnu archiver (ar) writes a table of contents of archive to the standard output. Only the files specified by the file operands shall be included in the written list. If no file operands are specified, all files in archive shall be included in the order of the archive.

More info here.


You can see the contents (the .o files that went into it) and the defined symbols by using nm. If this contains C++ code you should use the -C option to demangle the symbol names:

nm -C libschnoeck.a | less


On a Mac, simply use

nm libschnoeck.a | less

There is no -C option with the Mac version of nm.