Plugins - Interchangeable Components

Synopsis:

Plugins are code components that a host application loads and uses to enhance its default functionality. Plugins implement a plugin interface and object factory and are built as shared libraries. The application host loads the plugin, activates it using the object factory, and uses its services.

Host/Plugin Requirements:

In order to implement a host and plugin:
  1. The host declares a plugin interface defining functions it knows how to call and an object factory to create instances of the plugin class(es).
  2. Optionally, the host provides a registration interfact (implemented by the host) that allows multiple plugins to register with the host for activation and use.
  3. If the host provides a registration interface, then the plugin interface must contain a function for the host to pass a pointer to its registration interface to the plugin to use for registration.
  4. The plugin component implements the interface declared by the host.
  5. The plugin is built as a shared library to that it can be loaded when the host starts or later when the host needs its services.

Interface and Object Factory Example Code:

Plugin Sample Code:

Shared Library References:

Plugin Architecture References: