FLTK 1.3.3
Fl_Plugin Class Reference

Fl_Plugin allows link-time and run-time integration of binary modules. More...

#include <Fl_Plugin.H>

Inheritance diagram for Fl_Plugin:
Fl_Device_Plugin

Public Member Functions

 Fl_Plugin (const char *klass, const char *name)
 Create a plugin. More...
 
virtual ~Fl_Plugin ()
 Clear the plugin and remove it from the database.
 

Detailed Description

Fl_Plugin allows link-time and run-time integration of binary modules.

Fl_Plugin and Fl_Plugin_Manager provide a small and simple solution for linking C++ classes at run-time, or optionally linking modules at compile time without the need to change the main application.

Fl_Plugin_Manager uses static initialisation to create the plugin interface early during startup. Plugins are stored in a temporary database, organized in classes.

Plugins should derive a new class from Fl_Plugin as a base:

class My_Plugin : public Fl_Plugin {
public:
My_Plugin() : Fl_Plugin("effects", "blur") { }
void do_something(...);
};
My_Plugin blur_plugin();

Plugins can be put into modules and either linked before distribution, or loaded from dynamically linkable files. An Fl_Plugin_Manager is used to list and access all currently loaded plugins.

Fl_Plugin_Manager mgr("effects");
int i, n = mgr.plugins();
for (i=0; i<n; i++) {
My_Plugin *pin = (My_Plugin*)mgr.plugin(i);
pin->do_something();
}

Constructor & Destructor Documentation

Fl_Plugin::Fl_Plugin ( const char *  klass,
const char *  name 
)

Create a plugin.

Parameters
[in]klassplugins are grouped in classes
[in]nameevery plugin should have a unique name

The documentation for this class was generated from the following files: