Skip to content

Latest commit

 

History

History
95 lines (56 loc) · 3.05 KB

README-en.md

File metadata and controls

95 lines (56 loc) · 3.05 KB

gplug logo

1.Introduction

badge badge badge

gplug (general plugin management library) is a general plugin management library.

gplug is used for unified management of plugins in applications. It is responsible for loading, initializing, deinitializing, and unloading individual plugins, and supports adding and removing plugins at runtime.

gplug is designed to separate the plug-in interface from the user function interface. The plugin manager obtains the plugin function interface through the plugin specification interface, and then can directly interact with the plugin.

plugin

There are three main parts in gplug: plugin, plugin manager, and plugin configuration file.

Plugin

Each plugin is identified by a unique ID (file key), and the plugin must implement an interface that conforms to the plugin specification.

Plugin configuration file

The plugin manager uses a configuration file to manage the plugins in a unified manner. The configuration file contains parameters such as FileKey , delay loading.

Plugin Manager

The plugin manager initializes the corresponding plugin according to the file ID (FileKey), obtains the pointer of the plugin function interface function according to the function ID (InterfaceKey), and calls the function interface of different plugins.

2.Interface

gplug documentation is generated using Doxygen.

The interface is divided into two parts, the plugin manager interface and the plugin specification interface.

A plugin needs to implement the plugin interface, and the application program calls the plugin manager interface to implement plugin management.

3.Development steps

The process of developing is as follows:

Define the plugin functional interface ↓ Implement the plugin function interface ↓ Export plugin unified interface ↓ Create configuration file ↓ Use the PlugMgr interface to call the Plugin function interface

This is an example of developing a plugin according to the flow.

4.Examples

Check out more examples here.

5.Build

  1. Clone the repository
git clone https://gitee.com/QWorkShop/gplug.git
  1. Generate the necessary build files

    In this step, the third-party library will be cloned.

cd EVHttpServer
cmake -B build -S . -DCMAKE_INSTALL_PREFIX=/path/to/install -DCMAKE_BUILD_TYPE=Release
  1. Compile the source code. In this step, third-party libraries, gplug library, samples, tests will be compiled.
cmake --build build
  1. Install to system
cmake --install build

Now you can use the gplug library, include the header file in the code, link the gplug library when compiling.