`c2rust-refactor` has a simple plugin system, which is useful for mitigating the long compile times of the main `c2rust-refactor` binary. # Plugin API A plugin is simply a shared library that provides a function with the following signature: #[no_mangle] pub fn register_commands(reg: &mut c2rust_refactor::command::Registry) { ... } `c2rust-refactor` will call the `register_commands` function when the plugin is loaded, allowing it to add its commands to the command registry. Those commands will be available from the command line and editor integration, just like any built-in command. # Compiling a plugin Compile with a command like the following: ```bash rustc plugin_stub.rs \ --crate-type dylib \ -L target/debug/deps \ --extern c2rust_refactor=target/debug/libc2rust_refactor.rlib \ --extern log=target/debug/deps/liblog-d13cea69eadf9021.rlib \ --extern libc=target/debug/deps/liblibc-245f0779ba681f77.rlib ``` The hashes for `liblog` and `liblibc` may change depending on the details of your build environment - check the contents of `target/debug/deps` to find the right hash. # Loading plugins First, pass `c2rust_refactor` the `-P path` option to add a directory to the plugin search path. (The search path is empty by default, so no plugins can be loaded.) Then pass one or more `-p plugin_name` name options, to load `libplugin_name.so` for each option.