I don't know if this is possible. If I create an application, distributed as a closed-source native binary, can I also distribute plugins a separate binary files that extend the functionality of that app? Or is there not enough stable ABI for this?
The plugin would need to be able to use types in the application, and implement traits defined in the application.
Create plugins as external apps and use some kind of IPC (either OS-provided like COM or D-Bus or custom one, based on sockets, shared memory or pipes).
The second option also gives you ability to write plugins in any language and even run them on another host (if you decided to use sockets), but it is not an option for hot paths.
In both cases, you would need to publish a "Plugin SDK" openly.
There are some hacks, though: abi_stable - Rust but I've never tried them.
In order to achieve this, no matter what strategy you use beyond that, you must put the relevant types and traits in a crate whose source is available to the plugin authors.[1] This crate might be a plugin API crate without any of the logic of your application, though.
Technically you can distribute a compiled .rlib, but this requires the author to use a specific version of rustc, and doesn't necessarily hide much. ↩︎