49

Can you please tell me how can I dump all the symbols in a .a file on MacOS X?

I am getting a linking error while compiling my c++ problem on MacOS X. I would like to find out if the sybmols exists on the .a file that I am linking with.

Thank you.

n179911
  • 19,547
  • 46
  • 120
  • 162

2 Answers2

64

man nm

Nm displays the name list (symbol table) of each object file in the argument list. If an argument is an archive, a listing for each object file in the archive will be produced. File can be of the form libx.a(x.o), in which case only symbols from that member of the object file are listed. ... etc

Sinan Ünür
  • 116,958
  • 15
  • 196
  • 339
  • 1
    A similarly useful program is "strings", which prints everything in a binary that looks like a null terminated string. – markets Jul 30 '09 at 03:31
16

nm -g | c++filt

Mac nm doesn't have the demangle option, so you just run the output through c++filt (a demangler) afterwards.

Tomeamis
  • 477
  • 6
  • 14