Update
I was being foolish - I had a check to see if the file existed (in the same folder) before passing it to dlopen()
.. so the question is not valid, I will close it.
Original Question
For an exectuable that needs to link to a bunch of shared libraries in a different folder you can just do export LD_LIBRARY_PATH=/some/other/folder
and then when you run your exectuable it can find them - and that is all working as expected for me.
However one of my applications uses dlopen() to open a shared library at runtime (in a plug-in like way). I am using dlopen("libsome_lilb.so", RTLD_NOW)
.
So, this works if the plugin shared lib is in the same folder, but not if its in some other folder. So then I set LD_LIBRARY_PATH and re-try, but it still fails to find the library.
This is related to this question: c-linux-dlopen-cant-find-so-library
But that OP seems to have a varaition of this issue where they are trying to open a .so in the same folder... so I can't see a solution there.
Not quite sure what to tinker with now... maybe some of the options for dlopen("name", options);
? (that's a guess)