Expand description
A port of the FileMaker plug-in SDK.
Replicates much of the functionality found in the C++ library provided by FileMaker, which is mostly wrapping the C ffi, as well as some convenience functions.
Has only been tested with FileMaker 18 and 19 (windows, macos, and linux); your mileage may vary with older versions.
§Quick Start
You’ll want to make your project a library with a crate-type of cdylib
and set the resolver
option to 2
.
[package]
resolver = "2"
[lib]
path = "src/lib.rs"
crate-type = ["cdylib"]
Each custom function/script step must be configured in a FileMakerFunction
implementation.
pub struct MyFunction;
impl FileMakerFunction for MyFunction {
fn function(id: i16, env: &ExprEnv, args: &DataVect, result: &mut Data) -> FMError {
//log some info to the file set in config.toml
log("some troubleshooting info");
FMError::NoError
}
}
Next you’ll need to implement Plugin
for your plugin’s struct, defining all the information about the plug-in, as well as registering all the functions.
use fm_plugin::prelude::*;
struct MyPlugin;
impl Plugin for MyPlugin {
fn id() -> &'static [u8; 4] { &b"MyPl" }
fn name() -> &'static str { "MY PLUGIN" }
fn description() -> &'static str { "Does all sorts of great things." }
fn url() -> &'static str { "http://myplugin.com" }
fn register_functions() -> Vec<Registration> {
vec![Registration::Function {
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_ext_version: ExternVersion::V160,
min_fm_version: "18.0.2",
allowed_versions: AllowedVersions {developer: true, pro: true, web: true, sase: true, runtime: true},
function_ptr: Some(MyFunction::extern_func),
}
]
}
}
Lastly you’ll need to register the plug-in.
register_plugin!(MyPlugin);
Re-exports§
pub use binary_data::*;
pub use calc_engine::*;
pub use data::*;
pub use datetime::*;
pub use external::*;
pub use fixed_point::*;
pub use text::*;
pub use text_style::*;
pub use types::*;
Modules§
- binary_
data - calc_
engine - client
- config
- Handles the force quitting of FileMaker before building the plug-in. This serves two purposes:
- data
- datetime
- external
- ffi
- Contains all the C ffi wrappers.
- fixed_
point - helpers
- Various helper functions, including a logging function.
- plugin
- post_
build - Controls bundling of the plug-in after build. Utilizes the
cargo-post
crate. Requires settings to configured inconfig.toml
. - prelude
- Re-exports everything necessary for the register_plugin macro.
- text
- text_
style - types
Macros§
- register_
plugin - Sets up the entry point for every FileMaker call into the plug-in. The function then dispatches the calls to the various trait functions you can implement.
Impl
Plugin
for your plugin struct, and then call the macro on it.
Enums§
- Registration
- Register
ScriptSteps
andFunctions
for your plugin.
Traits§
- File
Maker Function - Plugin
- Implement this trait for your plugin struct. The different functions are used to give FileMaker information about the plugin. You also need to register all your functions/script steps in the trait implementation.
- Plugin
Internal
Functions§
- kill_
filemaker - Force quits FileMaker using the path provided in
config.toml
. - log
- Appends to log file specified in
config.toml
. - write_
to_ ⚠u16_ buff - Safety