ratatui_ffi
Native C ABI for Ratatui, exposing a small cdylib you can consume from C, C#, and other languages.
Status
- Targets the Ratatui workspace API (0.30 beta series). The crate currently depends on the workspace layout, which is why it has a path dependency to
ratatui. - If you want to build against crates.io instead, switch the dependency to a crates.io version (see below).
Build
# produces target/release/libratatui_ffi.so (Linux), .dylib (macOS), or ratatui_ffi.dll (Windows)
Using from C/C#
- Exported symbols use
extern "C"and a stable ABI. - See the C# wrapper in holo-q/ratatui-cs for a reference P/Invoke layer and SafeHandle pattern.
Install (Rust)
Switching to crates.io
- Current Cargo.toml uses:
= { = "../../ratatui/ratatui" } - To build standalone (without the workspace), replace with a version:
= "0.29" = "0.27" - Note: API has changed in 0.30+ (split crates). If you keep using 0.30 workspace (beta), retain the path dep or pin compatible versions across the split crates.
CI (optional)
- You can add a simple GitHub Actions workflow to build release artifacts for linux-x64, win-x64, osx-x64, osx-arm64 and upload them to releases.
- See holo-q/ratatui-cs for an example of multi-RID builds and packaging.