Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to observe the content of static lib in mac OS?

I create a static library project in my xCode and build a .a named mylib.a. There some code (.m files) and another static lib file named common.a to inform the static library nylib.a. But I doubt that if the contend of common.a are pack in the mylib.a really. So how can I observe the content of the mylib.a in mac OS? I knew there are some command such as ar, nm to complete this task in Linux. but It does't run in mac OS.

like image 474
qiushuitian Avatar asked Jul 18 '12 11:07

qiushuitian


People also ask

How do I view the contents of a static library?

If we want to see the contents of our library, we can use the ar option -t . We can also see the symbols in our library, using the command nm , which lists each symbol's symbol value, symbol type, and symbol name from object files.

What command can be used to list the symbols stored in a static library?

To list the symbols stored in the static library we can use the command “nm”, which lists each symbol's symbol value, symbol type, and symbol name from object files.

Is XCFramework dynamic or static?

An XCFramework can be either static or dynamic and can include headers.


1 Answers

"nm" most certainly does exist on the Mac (in the "/usr/bin/" folder).

If you do not see it there, then you probably need to install the "Command Line Tools for Xcode" that you'll find at https://developer.apple.com/downloads/index.action (you'll need an Apple Developer login to get access to this).

"nm" will dump all the symbols in a static library file for you. Here is the manual page for it.

like image 95
Michael Dautermann Avatar answered Oct 13 '22 02:10

Michael Dautermann