Writing static plugins
There are two types of plugins: static and dynamic. Static plugins are statically linked to the executables, while the dynamic plugins are loaded at runtime. Dynamic plugins exist as the .dll
or .so
files, depending on the platform. Although the static plugins will be built as the .lib
or .a
files, they'll be integrated into an executable file when the main program gets compiled.
In this topic, we'll get to know how to write a static plugin to extend the application. Serving as an external plugin, it gains the flexibility to change its internal code while it's only required to keep the interface compatible. It's up to you to decide whether the interface should be maintained in the main program or in different plugins. In this example, we'll put the interface.h
file in the main program, painter_demo
. The content of interface.h
is as follows:
#ifndef INTERFACE_H #define INTERFACE_H #include <QtPlugin> #include <QPainterPath> class InsertInterface { public...