Cómo imprimir una lista de símbolos exportados desde una biblioteca dinámica


Así que he estado tratando de conseguir bibliotecas dinámicas para trabajar en mi proyecto XCode bajo Mac OS X. Hasta ahora no hay alegría.

Puedo cargar el archivo dylib, pero cuando llamo a dlsym para obtener el puntero de la función, devuelve 0 y dlerror dice símbolo no encontrado.

Así que me pregunto si hay una manera sencilla de enumerar los símbolos que se exportan desde un archivo dylib. Cualquier idea sería genial.

 103
Author: bdesham, 2010-12-22

4 answers

Man 1 nm

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

Por ejemplo:

nm -gU /usr/local/Cellar/cairo/1.12.16/lib/cairo/libcairo-trace.0.dylib
 121
Author: MK.,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-07-01 02:56:06

Use otool :

otool -TV your.dylib

O

nm -g your.dylib
 51
Author: linuxbuild,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-09-13 20:32:59

Use nm -a your.dylib

Imprimirá todos los símbolos, incluidos los globales

 12
Author: Omkar Ramtekkar,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2013-08-29 07:00:45

Utilice Mach-OView para ver todos los Símbolos en dylib

Https://sourceforge.net/projects/machoview /

 0
Author: Sahil Doshi,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-06-03 11:14:48