Cargo.toml:
```toml [lib] path = "src/lib.rs" crate-type = ["cdylib"]
[dependencies] fm_plugin = "0.1.11"
[build-dependencies] fm_plugin = "0.1.11"
[package.metadata.cargo-post.dependencies] fm_plugin = "0.1.11" toml = "0.5" serde = { version = "1.0", features = ["derive"] } ```
config.toml:
```toml [filemaker] extpath = "path/to/filemaker/Extensions" binpath = "path/to/filemaker/executable.exe" kill = false launch = false
[plugin] name = "myplugin" bundle = false moveto_ext = false
[log] path = "path/to/plugin.log" clearonlaunch = false ```
build.rs:
```rust
fn main() -> Result<(), Box
post_build.rs:
```rust
fn main() -> Result<(), Box
lib.rs:
```rust use fm_plugin::prelude::*;
struct MyPlugin;
impl Plugin for MyPlugin { fn id() -> &'static [u8; 4] { &b"MyPl" }
fn name() -> &'static str {
"MY PLUGIN"
}
fn register_functions() -> Vec<ExternalFunction> {
vec![ExternalFunction {
id: 100,
name: "MyPlugin_MyFunction",
definition: "MyPlugin_MyFunction( arg1 ; arg2 )",
description: "Does some really great stuff.",
min_args: 2,
max_args: 2,
display_in_dialogs: true,
compatibility_flags: Compatibility::Future as u32,
min_version: ExternVersion::V160,
function_ptr: Some(MyFunction::extern_func),
}
]
}
...
}
pub struct MyFunction;
impl FileMakerFunction for MyFunction { fn function(id: i16, env: &ExprEnv, args: &DataVect, result: &mut Data) -> FMError { //log some info to the desktop (plugin.log) log("some troubleshooting info");
...
FMError::NoError
}
}
register_plugin!(MyPlugin); ```
cargo install cargo-post
If you set up the build/post_build scripts as shown above, running cargo post build --release
will: