How to list exported functions in a shared lib on Ubuntu

前端 未结 3 1519
小蘑菇
小蘑菇 2020-12-24 11:58

I have just built a shared lib on Ubuntu, and when I attempt to use the function, the application that loads the library is reporting \'xxx\' symbol not found.

I wan

相关标签:
3条回答
  • 2020-12-24 12:12
    nm -D -C -g <library>
    

    works well too.

    0 讨论(0)
  • 2020-12-24 12:18

    Try the nm utility.

    GNU nm lists the symbols from object files objfile.... If no object files are listed as arguments, nm assumes the file a.out. [reference]

    0 讨论(0)
  • 2020-12-24 12:26

    Is your shared library in the library load path or in the application's run-time search path? It sounds like the dynamic linker can't find your library. Try running ldd on your application to see if the library can be found at run-time, e.g.:

    $ ldd /usr/bin/less
        linux-gate.so.1 =>  (0x0072a000)
        libncurses.so.5 => /lib/libncurses.so.5 (0x00c68000)
        libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0x007c7000)
        libdl.so.2 => /lib/tls/i686/cmov/libdl.so.2 (0x00286000)
        /lib/ld-linux.so.2 (0x002a1000)
    

    See the ld.so(8) man page for additional details on library search paths.

    0 讨论(0)
提交回复
热议问题