NexusForce 1.0.0
A Modern C++ Library with extended functionality, web components, and utility libraries
载入中...
搜索中...
未找到
插件

动态加载插件管理 更多...

struct  plugin_info
 插件信息结构 更多...
struct  iplugin
 插件接口基类 更多...
struct  plugin_deleter
 插件自定义删除器 更多...
class  plugin_manager
 插件管理器单例类 更多...

宏定义

#define NEFORCE_PLUGIN_CREATE_FUNC   "create_plugin"
 插件创建函数名称
#define NEFORCE_PLUGIN_DESTROY_FUNC   "destroy_plugin"
 插件销毁函数名称

类型定义

using plugin_ptr = unique_ptr<iplugin, plugin_deleter>
 插件唯一指针类型

函数

iplugincreate_plugin ()
 创建插件实例
void destroy_plugin (iplugin *p)
 销毁插件实例

详细描述

动态加载插件管理

宏定义说明

◆ NEFORCE_PLUGIN_CREATE_FUNC

#define NEFORCE_PLUGIN_CREATE_FUNC   "create_plugin"

插件创建函数名称

插件必须导出的创建函数名,用于实例化插件对象。

在文件 plugin_entry.hpp28 行定义.

◆ NEFORCE_PLUGIN_DESTROY_FUNC

#define NEFORCE_PLUGIN_DESTROY_FUNC   "destroy_plugin"

插件销毁函数名称

插件必须导出的销毁函数名,用于释放插件对象。

在文件 plugin_entry.hpp36 行定义.

类型定义说明

◆ plugin_ptr

插件唯一指针类型

使用自定义删除器管理插件对象生命周期, 确保插件从正确的动态库中卸载。

在文件 iplugin.hpp155 行定义.

函数说明

◆ create_plugin()

iplugin * create_plugin ( )

创建插件实例

返回
指向新创建的插件对象的指针

此函数必须由插件实现并导出,用于创建插件实例。 返回的指针将由 destroy_plugin 函数销毁。

◆ destroy_plugin()

void destroy_plugin ( iplugin * p)

销毁插件实例

参数
p要销毁的插件对象指针

此函数必须由插件实现并导出,用于销毁通过 create_plugin 创建的插件对象。释放所有相关资源。