I am trying to map the address of a function that is supposed to exist inside a shared library (.so). I am sucessfully able to open the library and am trying to get the address of the function inside it as such:
fn_read = dlsym (handle, "functionName");
However I am getting an error, and upon inspection the error is that the symbol could not be found. I am pretty sure that I am making this call correctly. I am also 100% sure that the function that I am trying to map is included in the shared library itself. I’m not sure what to do here…could someone please point out some possible mistakes/points that I may be overlooking?
Thanks,
Fal
Try using the unix/linux command
nm -g <library>.so. It will list all of yourCstyle symbols.Note that C++ participates in “name mangling”, so if you don’t have a “C style” symbol exported, odds are the name was mangled and isn’t directly reachable.
nm -gC <library>.sowill also show the mangled C++ names.If you are attempting to access a C++ symbol, and name mangling is causing the problem, following the guidelines in the C++ FAQ light on mixing C and C++ can be helpful.