How do I view the list of functions a Linux shared library is exporting?

风流意气都作罢 提交于 2019-11-26 12:34:49

问题


I want to view the exported functions of a shared library on Linux.

What command allows me to do this?

(On Windows I use the program depends)


回答1:


What you need is nm and its -D option:

$ nm -D /usr/lib/libopenal.so.1
.
.
.
00012ea0 T alcSetThreadContext
000140f0 T alcSuspendContext
         U atanf
         U calloc
.
.
.

Exported sumbols are indicated by a T. Required symbols that must be loaded from other shared objects have a U. Note that the symbol table does not include just functions, but exported variables as well.

See the nm manual page for more information.




回答2:


objdump -T *.so may also do the job




回答3:


On a MAC, you need to use nm *.o | c++filt, as there is no -C option in nm.



来源:https://stackoverflow.com/questions/4514745/how-do-i-view-the-list-of-functions-a-linux-shared-library-is-exporting

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!