a simple example for creating a plugin system in Rust without dependencies (except for libloading for obvious reasons)
the main application (where the plugins get loaded)
definitions to be used for plugins and the application
an example plugin
- basically 0 overhead (since its pure rust)
- structure states, so no global variables
- you get to use the entire rust standard library
- you get to use any external crates rust provides
- the rust compiler should help with any errors at compile time
- not ffi safe, you should use abi_stable, but i don't like dragging in 50~70 dependencies
- no intellisense (rust-analyzer doesn't like working with the
include!
macro) - there might be lifetime issues with 'static, but it only seems to be an issue if you manually drop the library
- there might be issues with very very old versions of macos and linux
- compiling the application and plugin with different versions of the rust compiler MIGHT introduce issues (not ffi safe, yet again)