Archived

This forum has been archived. Please start a new discussion on GitHub.

How to load plugins in sles10?

Hi,


I have created an application which loads plugins. Those plugins reside inside the main executable it's directory.

On Windows I can load them no problem... But on sles10, I end up with the message "No such file or directory".

for example in the config I have: "Ice.Plugin.Db=mydb:create"

In the filesystem I have a "libmydb.so"


The (very weird) thing is that when I wrote a program:
int main()
{
  void * hdn = dlopen("/tmp/libmydb.so", RTLD_LAZY);
}

That "hdn" contains "NULL". And the dlerror() message says it cannot find the file. When I copy the .so 's to /usr/local/lib & run ldconfig everything works fine again... But that's not exactly what I want to do ;-)


So how could I make my program run with plugins in the local directory?


Thanks for any advise!

Comments

  • mes
    mes California
    Hi,

    dlopen looks for the shared library in the library search path. If the library is in your current directory, you should have "." in your LD_LIBRARY_PATH, such as

    $ export LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH

    Hope that helps,
    - Mark
  • That helped indeed ;).


    But ain't there a way to say inside the config to load "./libmydb.so" (for example if you detect a "/", then it won't construct a library name)?
  • mes
    mes California
    Hi,

    At present Ice's plugin loading mechanism doesn't support complete filenames; it assumes you're always using the "portable" syntax.

    Take care,
    - Mark