Reputation: 279
Is there any way to read the content of a .SO(shared objects) file without loading it?
My use-case scenario is:
Note: I can easily do these things on DLL. Also I am working on windows so I can't load a .SO file.
Thanks
Upvotes: 21
Views: 66701
Reputation: 279
yes needed solution for windows OS. I used the nm.exe tool present in ndk tools in android sdk/ndk.
i dumped the outputof nm.exe in some file and then using regular expression extracted out all the classes and methods from it.
Upvotes: 2
Reputation: 1404
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
Upvotes: 28
Reputation: 52357
You can read these files with tools included in the GNU binutils. While GNU binutils is typically installed on Linux systems, this is not the case for Windows. However, they run within Cygwin or minGW under Windows.
Resources:
Note that with MinGW (3.), you do not need Cygwin (2.) and compile Binutils (1.) yourself. Binutils is included in MinGW (3.), but you can also try to download just the Binutils part of MinGW (4.).
How to use nm
and readelf
to obtain the information is explained here:
How do I list the symbols in a .so file
If you want to include this functionality into a C++ program, you could either incorporate the source code of these tools (beware of the license!) or call them from within your program. Probably you will need a Cygwin environment to get the source code compile under Windows.
Upvotes: 5