title: How can a Plugin call Other Plugins with C++?
body: <p>This is a plugin system which is based on the factory pattern.
  Each plugin extends the <code>Plugin</code> class and implements a factory that returns the extended class to the kernel.</p>
  
  <p>Plugins are compiled as shared libraries. Kernel checks the <code>plugins/</code> directory and loads all libraries at runtime.
  When the red button is clicked, the kernel calls <code>call_on_red_click()</code> on every loaded plugin.</p>
  
  <pre><code>// Plugin.h
  class Plugin {
  public:
      virtual void call_on_blue_click() = 0;
      virtual void call_on_red_click() = 0;
  }
  
  // MyPlugin.h
  class MyPlugin : public Plugin {
  public:
      void call_on_blue_click() {/*[...]*/}
      void call_on_red_click() {
          // Does something
          // Optionaly, activate teleporter
      }
  }
  
  Plugin *plug_factory() { return new MyPlugin; }
  
  // MyOtherPlugin.h
  class MyOtherPlugin : public Plugin {
  public:
      void call_on_blue_click() {/*[...]*/}
      void call_on_red_click() {
          // Does something else
          // Optionaly, activate teleporter
      }
  }
  
  Plugin *plug_factory() { return new MyOtherPlugin; }
  </code></pre>
  
  <p>The teleporter is compiled separately and may not be present in every installation (It's shiped by itself).
  Lets say that MyPlugin and MyOtherPlugin want to activate the teleporter <strong>if</strong> it is present.</p>
  
  <p><strong>Questions:</strong></p>
  
  <ol>
  <li>Should the Teleporter be a kernel Plugin or something else?</li>
  <li>Is there a design pattern for this?</li>
  </ol>