From 8cad0b7a6caee3c679c0771c7ed556e0ce4170b7 Mon Sep 17 00:00:00 2001 From: Kingtous Date: Thu, 13 Apr 2023 15:00:01 +0000 Subject: [PATCH] opt: add flutter feat --- examples/custom_plugin/Cargo.toml | 7 ++++++- examples/custom_plugin/src/lib.rs | 2 ++ src/plugins.rs | 4 ++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/examples/custom_plugin/Cargo.toml b/examples/custom_plugin/Cargo.toml index 106e48ebb..b9ee06ae7 100644 --- a/examples/custom_plugin/Cargo.toml +++ b/examples/custom_plugin/Cargo.toml @@ -10,9 +10,14 @@ name = "custom_plugin" path = "src/lib.rs" crate-type = ["cdylib"] + +[features] +default = ["flutter"] +flutter = [] + [dependencies] lazy_static = "1.4.0" -rustdesk = { path = "../../", version = "1.2.0"} +rustdesk = { path = "../../", version = "1.2.0", features = ["flutter"]} [profile.release] lto = true diff --git a/examples/custom_plugin/src/lib.rs b/examples/custom_plugin/src/lib.rs index be051c1d9..860e0366a 100644 --- a/examples/custom_plugin/src/lib.rs +++ b/examples/custom_plugin/src/lib.rs @@ -9,6 +9,8 @@ lazy_static::lazy_static! { pub static ref API: RustDeskApiTable = RustDeskApiTable::default(); } + + #[no_mangle] fn plugin_name() -> *const c_char { return PLUGIN_NAME.as_ptr(); diff --git a/src/plugins.rs b/src/plugins.rs index 3235bce4a..dfbdc7753 100644 --- a/src/plugins.rs +++ b/src/plugins.rs @@ -36,8 +36,8 @@ pub trait Plugin { #[repr(C)] #[derive(Default, Clone)] pub struct RustDeskPluginTable { - pub init: Option, - pub dispose: Option, + pub init: Option, // NonNull + pub dispose: Option, // NonNull } pub struct PluginImpl {