Reputation: 4804
I need a way to enumerate symbols and their addresses exported from dylibs on Mac OS X.
From the shell I would normally use nm
for this - is there a library which I can use from my code to get the same things that nm
provides? Similar to the dbghelp API on Windows.
As a last resort I suppose I could spawn nm
and parse the output but I'm keen to avoid this if there is a cleaner method.
Upvotes: 3
Views: 928
Reputation: 616
nm (and otool) have the knowledge built into them rather than using an API. The best you will get is header files defining the file format (see 'man Mach-O'). I would invoke nm and parse the output; there's nothing wrong with reusing an existing component just because the interface is program execution rather than function call.
Upvotes: 3