Files
ShowenV2/plugins/example-plugin/README.md
showen 7135f28545 feat: 实现动态插件系统 (6阶段完成)
- 阶段1: 消息类型序列化 (Serialize/Deserialize, &'static str → String)
- 阶段2: FFI 边界类型 + Plugin SDK (plugin_abi, showen-plugin-sdk crate)
- 阶段3: PluginLoader + DynamicPlugin (libloading 动态加载 .so)
- 阶段4: 版本管理 + 错误策略 (VersionManager, PluginState, 自动回退)
- 阶段5: 远程仓库客户端 (HTTP 下载 + tar.gz 安装)
- 阶段6: 示例插件 + HTTP 管理 API + 全目录 README 文档

54/54 测试通过,0 warnings。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 03:38:08 +08:00

30 lines
673 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Example Plugin — 示例动态插件
演示如何使用 `showen-plugin-sdk` 编写动态插件。
## 功能
- 仅打印日志,用于验证动态加载流程
- 展示 `ShowenPlugin` trait 的完整实现
- 编译为 `cdylib``.so` 文件)
## 编译
```bash
cd plugins/example-plugin
cargo build --release
```
产物: `target/release/libshowen_example_plugin.so`
## 安装
`.so``manifest.json` 放入 `plugin_store/example-plugin/<version>/` 目录即可被主程序动态加载。
## 文件
| 文件 | 说明 |
|------|------|
| `src/lib.rs` | 插件实现,使用 `export_plugin!` 宏导出 |
| `Cargo.toml` | crate 配置,类型为 cdylib |