[lug] Universal Module/Plugin Loader

Alan Robertson alanr at unix.sh
Wed Jun 6 22:08:43 MDT 2001


Hi,

I spent some time looking for a "universal module/plugin" loader for 'C'. 
Didn't find what I was looking for.

What I mean is one that would dynamically load .so files and manage
registration of plugins, etc.

The idea is that a larger software system probably has several kinds of
plugins, and that you need some software which would manage basically an
arbitrary number of plugin types.

I have it designed and about 1/3 - 1/2 written at this point, but I thought
I ought to slow down for a minute and ask if anyone knows of such a thing...

If not, what I'm designing is pretty cool...  [and I suppose it's only a
little less cool even if it duplicates something already out there].

So, does anyone know of such a library?  I need more intesting semantics
than libtldl or the Glib module loader (AFAIK).

------------------------------------------------

As an FYI, here's what I'm writing...

Some terminology:
A module is a dynamically loadable file - on UNIX, a .so file
A plugin is a set of functions that meet an interface described in a
structure of function pointers.  Plugins usually live inside of modules. 
It's common to have one plugin per module.

All modules are treated basically alike.

All plugins are classed into types.  Every plugin of a given type is treated
the same.  Each type of plugin in managed by a loadable module of type
Plugin.

For example, the Plugin plugin named "auth" manages all plugin registration
for modules of type "auth".  It is responsible for knowing what it means to
register a plugin of type "auth".

The plugin of type Plugin named Plugin (the PluginPlugin) is the only built
in plug in.  All others are loaded dynamically as requests are made to
manage plugins of a given type.  So, when a Plugin wants to register itself
of type "foo", the plugin named "foo" of type "Plugin" is automatically
loaded to manage things.

So, it's a pretty universal/generic/general design, and not specifically
tied to heartbeat or high-availability.

If anyone knows of something comparable to this that's out there please let
me know, so I can use it instead of reinventing it.

	Thanks!

	-- Alan Robertson
	   alanr at unix.sh



More information about the LUG mailing list