ratatui_ffi 0.1.0

C ABI bindings for Ratatui (Rust TUI) to consume from C/C#/etc.
Documentation

ratatui_ffi

CI GitHub Release crates.io crates.io downloads docs.rs

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

cargo build --release
# 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)

cargo add ratatui_ffi

Switching to crates.io

  • Current Cargo.toml uses:
    ratatui = { path = "../../ratatui/ratatui" }
    
  • To build standalone (without the workspace), replace with a version:
    ratatui = "0.29"
    crossterm = "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.