-
Notifications
You must be signed in to change notification settings - Fork 2
Description
feedtui is currently designed as a standalone Rust terminal application built with ratatui. To broaden adoption and enable integration into native systems workflows, it would be valuable to expose a stable C-compatible FFI layer so that C++ users can:
• Build feedtui from source and invoke it programmatically
• Embed or launch the TUI from existing C++ applications
• Distribute feedtui as a shared/static library usable outside the Rust ecosystem
This would allow non-Rust users to leverage the TUI without needing to understand Rust internals.
⸻
Proposed Solution
Introduce a C ABI boundary that exposes a minimal, stable interface for interacting with feedtui.
-
Rust-side FFI Layer
• Add a dedicated ffi module/crate
• Use #[no_mangle] extern "C" functions
• Expose lifecycle-style APIs, for example:
• feedtui_init(config)
• feedtui_run()
• feedtui_shutdown() -
Build Artifacts
• Support building:
• libfeedtui.so / libfeedtui.dylib
• Optional static library
• Provide a cargo build --features ffi path -
C/C++ Headers
• Generate or maintain a C header (feedtui.h)
• Ensure:
• Opaque handles instead of Rust types
• Explicit ownership and memory rules
• No Rust panics cross the FFI boundary -
Example Usage
• Provide:
• Minimal C++ example (main.cpp)
• Build instructions using cmake or clang++
• Demonstrate:
• Initializing the app
• Running the TUI
• Clean shutdown
Open Questions
• Should the FFI be gated behind a feature flag?
• Do we want to guarantee ABI stability across minor versions?
• Should we support launching feedtui as a library and a CLI?