Is there a way to read the contents of .so file without loading it?

Guruji picture Guruji · Oct 16, 2013 · Viewed 38.4k times · Source

Is there any way to read the content of a .SO(shared objects) file without loading it?

My use-case scenario is:

  1. I have a .so file on windows. I need to query for some methods whether they are present in .so or not.
  2. To know all the classes in a .so file.
  3. Given a class name need to find all the methods on this class.

Note: I can easily do these things on DLL. Also I am working on windows so I can't load a .SO file.

Thanks

Answer

TCAllen07 picture TCAllen07 · Mar 13, 2015

To screen: readelf -a <file>

To save the output, dump it into a file. For example, I'm learning about the Python RPi.GPIO module on Raspberry Pi, which is stored in /usr/lib/python2.7/dist-packages/RPi, so I run: readelf -a GPIO.so > ~/gpio.so.out