How to print a list of symbols exported from a dynamic library

So I've been trying to get dynamic libraries to work in my XCode project under Mac OS X. So far no joy.

I am able to load the dylib file, but when I call dlsym to get the function pointer, it returns 0 and dlerror says symbol not found.

So I am wondering if there is a simple way to list the symbols that are exported from a dylib file. Any ideas would be great.


man 1 nm

https://developer.apple.com/legacy/library/documentation/Darwin/Reference/ManPages/man1/nm.1.html

For example:

nm -gU /usr/local/Cellar/cairo/1.12.16/lib/cairo/libcairo-trace.0.dylib

Use otool:

otool -TV your.dylib

OR

nm -g your.dylib

Use nm -a your.dylib

It will print all the symbols including globals

链接地址: http://www.djcxy.com/p/54912.html

上一篇: 如何在Mac OS X上启动PostgreSQL服务器?

下一篇: 如何打印从动态库导出的符号列表