[LC++] Logical/structural question about plugin systems

Jack Lloyd lloyd at randombit.net
Mon Jun 11 21:22:44 UTC 2007

On Mon, Jun 11, 2007 at 10:34:22PM +0200, Julien Claassen wrote:
> Hi everyone!
>   I'm working on an I/O library. but there's a question. I plan to have input 
> and output plugins, that can be loaded via at runtime via a user-config-file. 
> But there needs to something like an exclusion clause built into the library, 
> because some i-plugins can't work with o-plugins. How best to realise the 
> exclusion matrix? I think it might be best to do it at a global level, because 
> modules/plugins might be added and so we can easily keep track of it.
>   Any ideas, suggestions?
>   Kindest regards
>           Julien

I would say it depends greatly on a few factors, namely how many
plugins you expect there to be, and who is going to be
writing/maintaining them. If it is actually possible to know at
compile time of the main application which plugins will exist and
which ones are compatible with each other, then doing it that way is
certainly easiest. However it's also a bit gross, and more to the
point makes it very difficult for a third party plugin developer to
integrate into your code.

Alternatives that come to mind would be having each plugin know which
other plugins it is not compatible with, or providing whatever
services are needed in the main application so each plugin can inspect
the other plugins and decide on the basis of behavioral differences if
it is possible for it to run. That also allows more complicated
behavior such as a plugin Z that works unless both plugin X and plugin
Y are both loaded, in which case it doesn't, and so on.


More information about the tuxCPProgramming mailing list