Open
Conversation
This adds a stable C-compatible FFI layer that enables C/C++ applications to integrate feedtui as a library. Features: - Lifecycle APIs: feedtui_init, feedtui_run, feedtui_shutdown - Config from file path or inline TOML string - Error handling with last_error retrieval - Version and feature queries - Opaque handles for safe memory management Build artifacts: - libfeedtui.so/.dylib/.dll (shared library) - libfeedtui.a/.lib (static library) - feedtui.h (C header) Documentation: - Comprehensive FFI guide in docs/FFI.md - C and C++ examples in examples/cpp/ - Makefile for building examples Usage: cargo build --release --features ffi Closes #12 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds a stable C-compatible FFI layer that enables C/C++ applications to integrate feedtui as a library, addressing issue #12.
Features Added:
Lifecycle APIs:
feedtui_init(config_path)- Initialize with config filefeedtui_init_with_config(toml_string)- Initialize with inline configfeedtui_run(handle)- Run the TUI (blocks until quit)feedtui_shutdown(handle)- Clean shutdown and resource cleanupUtility Functions:
feedtui_get_last_error(handle)- Get detailed error messagesfeedtui_version()- Get library versionfeedtui_has_feature(name)- Check compile-time featuresBuild Artifacts (with
--features ffi):libfeedtui.so/libfeedtui.dylib/feedtui.dll(shared)libfeedtui.a/feedtui.lib(static)include/feedtui.h(C header)Documentation:
docs/FFI.mdExamples:
examples/cpp/main.cpp- Full C++ example with argument parsingexamples/cpp/simple.c- Minimal C exampleexamples/cpp/Makefile- Build system for examplesKey Design Decisions:
catch_unwindffiflag (no overhead when not used)Usage:
Test plan
cargo build --release --features ffitarget/release/makeinexamples/cpp/Closes #12
Generated with Claude Code