Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

C++ Plugin Development

DaiC utilizes the Qt PluginLoader system to dynamically load C++ extensions. Dependencies

To build a compatible plugin, you must link against the DaiC core:

  • Library: Link against DaiCCoreCpp.
  • Headers: Include the DaiCCore headers in your project path.

The Plugin Interface

Every plugin must inherit from the Plugin base class and use the Qt metadata macros. C++

#include <DaiCCore/Plugin.hpp>
#include <QObject>

class Example : public QObject, public Plugin {
    Q_OBJECT
    Q_PLUGIN_METADATA(IID "com.DaiC.Plugin")
    Q_INTERFACES(Plugin)

public:
    // Lifecycle Methods
    void init() override;
    void run() override;
    void terminate() override;

    // Metadata Methods
    std::string name() const override;        // Must match folder/library name
    std::string author() const override;
    std::string description() const override;
    std::string version() const override;
};

Deployment Structure

The loader is strict about naming conventions. The class name, the containing folder, and the compiled binary must all share the same name.

Example Structure:

plugins/
└── cpp/
    └── Example/            <-- Folder Name
        └── libExample.so   <-- Binary Name (Example.dll on Windows)

On Linux, ensure your library is prefixed with lib. On Windows, the loader expects Example.dll.