ARCHIVED: Determine whether a routine exists within a library file in Linux
In Linux, to check whether a routine exists within a library file, use the nm
command with the -g
option, and pipe the output to grep
.
For example, to check whether the cos
function exists within the shared version of the standard math library (libm.so
), on the Linux command line, enter (replace /path/to/libm.so
with the location where libm.so
is installed on your system):
nm -g /path/to/libm.so | grep " cos"
Alternatively, to check whether the cos
function exists within the static version of the same library (libm.a
), use the ar
command with the -t
option and pipe the output to grep
; for example (replace /path/to/libm.a
with the location where libm.a
is installed on your system):
ar -t /path/to/libm.a | grep " cos"
cos
is preceded by a space.
For more about nm
and ar
, see each command's manual page.
This is document aqoz in the Knowledge Base.
Last modified on 2023-04-21 16:55:53.