Reputation: 465
I have a .so lib file that is not written by me. this is on a QNX arm-le system with eclipse as ide.
If i open the file with ida pro , i can see a lot of exported functions.
I want to call one of these functions.
I tried :
handle = dlopen ("/tmp/lib.so", RTLD_LAZY);
if (!handle) {
fputs (dlerror(), stderr);
exit(1);
}
cosine = dlsym(handle, "cos");
if ((error = dlerror()) != NULL) {
fputs(error, stderr);
exit(1);
}
That gives
unknown symbol: _ZTVN10__cxxabiv120__si_class_type_infoE
unknown symbol: _ZTVN10__cxxabiv120__si_class_type_infoE
unknown symbol: _ZTVN10__cxxabiv120__si_class_type_infoE
unknown symbol: _ZTISt9exception
Unresolved symbols
Upvotes: 0
Views: 1220
Reputation: 213375
You are not distinguishing between dlopen
and dlsym
errors (you should).
The error you get is from dlopen
, and it means that /tmp/lib.so
has dependency on your standard C++ runtime library (usually libstdc++.so
) symbols, but was not itself linked against libstdc++.so
.
To fix this, you must make libstdc++.so
available, by either
g++
instead of gcc
, or adding -lstdc++
to the link line, ordlopen("libstdc++.so", RTLD_GLOBAL)
before trying to dlopen
/tmp/lib.so
.Upvotes: 2