gimmeamilk
gimmeamilk

Reputation: 2110

Linux: alter LD_LIBRARY_PATH at runtime

I'm working on a simple plugin architecture for my app. A plugin is a shared object with a known "get interface" function. I access the .so via dlopen/dlsym etc. Fairly standard. Some of my plugins have extra .so files that need to be loaded too. These files can be shipped with a plugin fine, but I need the app to know where/how to load them.

So my question is: how to I add a particular plugin's directory to the list of places to look for libraries? I can't set LD_LIBRARY_PATH before starting the app, as the plugin will be loaded some time later. Alternatively, do I need each plugin to explicitly provide the list of dependencies in some kind of manifest file, so that I may load them with dlopen() first? Thanks.

Edit: to clarify, the plugins' directories are not known prior to starting the app, so I cannot set the LD_LIBRARY_PATH at that time.

Upvotes: 1

Views: 590

Answers (1)

Serge
Serge

Reputation: 1067

According to this linux evaluates LD_LIBRARY_PATH before starting the app, so it is unaware of any changes you make at runtime.

Upvotes: 1

Related Questions