On Wed, Sep 17, 2014 at 04:43:04PM +0000, Dicebot via Digitalmars-d wrote:
> I presume you mean dynamically loaded .so libraries and not just
> dynamically linked? Because latter use the same library path
> resolution rules as in C world (ld takes care of that)
> 
> As for dynamically loaded ones - it is somewhat tough question.
> Loading non-local plugin .so libraries is quite unusual, Derelict is
> the only software I know that does it. I am not sure it is even a good
> idea in general.
> 
> Are there any examples how this is solved in other languages /
> platforms?

In C / Posix, you can load any library dynamically using dlopen(),
dlsym(), et al, manually "link" your program by extracting function
pointers and data pointers. Some applications use this to implement a
plugin mechanism -- some Linux media players do this, I believe, and
browsers probably also use the same mechanism for browser plugins.

In any case, dlopen() uses the OS's dynamic linker to find libraries, so
it's really a matter of setting up your OS environment to be able to
find the libraries. It's not really within the scope of the D runtime to
attempt to configure this. Furthermore, some application plugin
frameworks may do things like fiddle with LD_LIBRARY_PATH to get it to
look for libraries where the dynamic linker wouldn't usually look; in
that case, you're really at the mercy of the plugin framework author(s)
as to how to configure such lookups. Again, it's not really within the D
runtime's mandate to control such things.

As for how it works on Windows, I have no idea at all. It's probably
completely different from Posix, which is more reason to leave it up to
plugin framework implementors to implement, rather than hard-coding an
incomplete / inconsistent implementation in druntime.


T

-- 
One disk to rule them all, One disk to find them. One disk to bring them all 
and in the darkness grind them. In the Land of Redmond where the shadows lie. 
-- The Silicon Valley Tarot

Reply via email to