problems with dlopen()

Hi,

my dlopen function is returning null even though the path for the .so file is valid. can anyone help?

this is the line of code

void* handle = dlopen("../_binlinux/CollectionsEx.so", RTLD_LAZY);

when i cout << handle; it prints 0 to the screen
Have you tried
1
2
void* handle = dlopen( ... );
if (!handle) cout << dlerror() << endl;

Chances are that the CollectionsEx.so library requires another library that cannot be resolved.
If the library has dependencies on other shared libraries, then these are also automatically loaded by the dynamic linker using the same rules. (This process may occur recursively, if those libraries in turn have dependencies, and so on.)
http://linux.die.net/man/3/dlopen

Hope this helps.
so your saying, basically that the problem is not that im incorrectly loading the library, but that the library which i trying to load has errors? ok, thanks! i'll look that over
I'm not saying that at all.

I suggested two things:

1) Use dlerror() to tell you what is going wrong

2) Make sure that all the libs required by CollectionsEx.so are available.

Good luck!
Hi,

By any chance, I'm not sure, but the name of the path has not to finish with \0 ?
In a statement like

dlopen("../_binlinux/CollectionsEx.so", RTLD_LAZY);
the path definitely ends with \0 the compiler does that for you.
Last edited on
Topic archived. No new replies allowed.