Welcome to pid-modules package !
pid-modules provides utility libraries for easier DLL management and plugins systems creation
Quick Examples
The two functional libraries are:
dll
, a simple library for easy runtime modules management (loading, suing symbol) in a PID environment. Its main purpose is to avoid boring with operating system specific primitives and to automate DLL location resolution.
#include <pid/dll.h> //use the DLL API
...
pid::DLLLoader dll("my-package","my-module");//load a module
auto func = dll.symbol<void()>("register_pid_plugin_extensions");//use one of its symbols
func();
-
plugins
, used to ease the implementation of runtime plugin systems for your applications. Its main purpose is to automate the management of extension points definition and automate extensions binding into an application. - Declare an extension point:
#include <pid/plugins.h> ... class Vehicle{//declare an interface public: virtual bool fly() const = 0; }; PID_EXTENSION_POINT(vehicle::Vehicle, 1, 0)
- Define a plugin that provides an extension to this extension point:
#include <pid/plugins.h> #include <vehicle.h> class Plane : public Vehicle{ public: virtual bool fly() const override{ return true; } }; PID_PLUGIN_DEPENDENCIES={}; PID_PLUGIN_DEFINITION(){ pid_plugins().add_extension<Vehicle,Plane>();//Plane is an extension for Vehicle }
- Use the plugin in an application to contribute to the extension point:
... pid_plugins().add_extension_point<Vehicle>(); pid_plugins().load("some_package", "a_plugin"); auto all_ext = pid_plugins().extensions<Vehicle>();//search for extensions for (auto & ext: all_ext) { auto v = ext->create(); v->fly();//polymorphic call from Vehicle static type }
First steps
If your are a new user, you can start reading introduction section and installation instructions. Use the documentation tab to access useful resources to start working with the package.
To lean more about this site and how it is managed you can refer to this help page.