opt: add flutter feat

This commit is contained in:
Kingtous 2023-04-13 15:00:01 +00:00 committed by Kingtous
parent bdd314856f
commit 8cad0b7a6c
3 changed files with 10 additions and 3 deletions

View File

@ -10,9 +10,14 @@ name = "custom_plugin"
path = "src/lib.rs" path = "src/lib.rs"
crate-type = ["cdylib"] crate-type = ["cdylib"]
[features]
default = ["flutter"]
flutter = []
[dependencies] [dependencies]
lazy_static = "1.4.0" lazy_static = "1.4.0"
rustdesk = { path = "../../", version = "1.2.0"} rustdesk = { path = "../../", version = "1.2.0", features = ["flutter"]}
[profile.release] [profile.release]
lto = true lto = true

View File

@ -9,6 +9,8 @@ lazy_static::lazy_static! {
pub static ref API: RustDeskApiTable = RustDeskApiTable::default(); pub static ref API: RustDeskApiTable = RustDeskApiTable::default();
} }
#[no_mangle] #[no_mangle]
fn plugin_name() -> *const c_char { fn plugin_name() -> *const c_char {
return PLUGIN_NAME.as_ptr(); return PLUGIN_NAME.as_ptr();

View File

@ -36,8 +36,8 @@ pub trait Plugin {
#[repr(C)] #[repr(C)]
#[derive(Default, Clone)] #[derive(Default, Clone)]
pub struct RustDeskPluginTable { pub struct RustDeskPluginTable {
pub init: Option<PluginInitFunc>, pub init: Option<PluginInitFunc>, // NonNull
pub dispose: Option<PluginDisposeFunc>, pub dispose: Option<PluginDisposeFunc>, // NonNull
} }
pub struct PluginImpl { pub struct PluginImpl {