anvil-sys
Raw Rust bindings to the plugin API 2 of Anvil,
the native plugin loader for Europa Universalis IV 1.37.5 (include/anvil/anvil_plugin.h).
no_std, no dependencies.
src/bindings.rsis generated bybindgenfrom the header and committed. CI regenerates it and fails when it differs (sdk/rust/regen-bindings.ps1).AnvilCpuContextis#[repr(C)], 408 bytes (checked at compile time).- C enums are plain integer constants (
AnvilResult,ANVIL_OK, …): a value from the host never becomes an invalid Rust enum. AnvilPluginLoadFnis the type ofanvil_plugin_load, the one function a plugin exports. The crate declares no extern functions.
A plugin is a cdylib that exports anvil_plugin_load and returns an
AnvilResult. Catch panics at every function the game or Anvil calls: unwinding
into them aborts the process. examples/hello-rust in the Anvil repository is a
complete plugin; anvil gen --lang rust writes the typed symbols
(symbols.gen.rs) from the plugin's symbols.toml.
The version of this crate is the version of Anvil whose header it binds. A safe
anvil crate on top of it is planned.
License: MIT.