general question about lazy loading of shared libraries

Mike Hearn mike at navi.cx
Fri Nov 19 18:15:05 UTC 2004


On Fri, 19 Nov 2004 07:07:12 -0500, John Ellson wrote:
> Well, yes, thats the direction I was headed in, but I'm wondering if the 
> performance payoff is going
> to be worth the effort of hand coding the dlopen plugin support?

You can use this program to make using dlopen trivial:

http://cvs.sunsite.dk/viewcvs.cgi/*checkout*/autopackage/apbuild/relaytool

At least it works for x86 and there is some basic code (untested) in there
for PowerPC. I keep meaning to find somebodies Mac laptop to borrow and
finish it off.

Executive summary, you can write code like you normally would except that
the library will be dlopened and the symbols linked automatically, eg:

if (libfoo_is_present)
{
	foo_bar();
}

works. Obviously this is designed for the case where you want to be able
to operate in the absence of a library rather than for when you have
multiple libraries all implementing the same interface as you would have
for a plugin solution. It makes depending on libraries in a soft fashion
much more convenient though. 

If you don't already have a plugin abstraction in place this might be what
you want.

Hope that helps.

thanks -mike




More information about the fedora-devel-list mailing list