In addition to Extend a dynamic linked shared library? I would like to find out, how I can get a list of all public methods of a shared library with closed source.
I have tried
nm -D libfoo.so
readelf -s libfoo.so
but there I'm missing informations like return type, arguments etc.
As a beginner in this area, I can't even figure out what of those methods would be callable for my application.
Has anyone a more helpful tool?
EDIT:
For a very simple example, I have following:
libtest1.c:
int puts(char const *);
void libtest1()
{
puts("libtest1: called puts()");
}
Then I compiled libtest1.c to libtest1.so:
gcc -fPIC -shared -o libtest1.so libtest1.c
In my "program" (test.c) I use the shared library as following:
void libtest1(); //from libtest1.so
int main()
{
libtest1();
}
And compile test.c to test:
gcc -o test test.c -ltest1 -ldl
This will work although I have NO libtest1.h to include. It works "just" because I know that there might be a libtest1()-method to call.
Now think of I lost libtest1.c and just have the libtest1.so in my hands and don't remember what there are for methods and what params do they need.
That's a stupid example, I know :)
Or as an other example (maybe better):
Let's assume I found a "libstone2goldconverter.so" somewhere in my system and think "oh my god, I will use it".. but how?