Skip to content

Add C API (staticlib), release bundles, and README#3

Merged
cursor[bot] merged 8 commits intomasterfrom
cursor/c-api-ffi-staticlib-6f5a
Apr 15, 2026
Merged

Add C API (staticlib), release bundles, and README#3
cursor[bot] merged 8 commits intomasterfrom
cursor/c-api-ffi-staticlib-6f5a

Conversation

@LycanW
Copy link
Copy Markdown
Owner

@LycanW LycanW commented Apr 15, 2026

Summary

This change adds a stable C ABI for embedding rs_ctrl_os from C/C++, ships librs_ctrl_os.a + rs_ctrl_os.h only (no official .so), bumps the crate to 0.5.0, and documents prebuilt glibc artifacts plus CI.

What changed

  • src/ffi.rs: extern "C" entry points for logging, ConfigManager<toml::Value> (dynamic as JSON), discovery, PubSubManager (publish_raw / try_recv_raw with heap-allocated outputs), time sync, error buffer.
  • include/rs_ctrl_os.h: Public C contract and error codes.
  • Cargo.toml: crate-type = ["lib", "staticlib"], libc dependency, version 0.5.0.
  • .cargo/config.toml: CXX=g++ / CC=gcc so bundled zmq-sys builds reliably when the default c++ is clang without libstdc++ headers.
  • c_examples/minimal.c: Minimal link example (-lzmq -lstdc++ -lpthread -ldl -lm).
  • tests/c_ffi_smoke.rs: Smoke test calling FFI from Rust.
  • .github/workflows/release.yml: On v* tags, build x86_64 and aarch64 *-unknown-linux-gnu, package librs_ctrl_os.a, include/rs_ctrl_os.h, SHA256SUMS, attach to GitHub Release.
  • README.md: New C API section (prebuilt layout, glibc note, link line).
  • src/config.rs: Doctest blocks marked ignore so cargo test passes.

Notes for reviewers

  • Prebuilt archives do not ship libzmq; users still link -lzmq (and -lstdc++ when using gcc against this staticlib due to bundled libzmq C++ objects).
  • ARM64 job uses ubuntu-24.04-arm runner; adjust if your org uses a different label.
Open in Web Open in Cursor 

cursoragent and others added 8 commits April 15, 2026 01:13
- Bump version to 0.5.0; export stable C ABI via src/ffi.rs and include/rs_ctrl_os.h
- Build staticlib only; document no official .so in releases
- Add c_examples/minimal.c, FFI smoke test, .cargo CXX=g++ for zmq-sys
- GitHub Actions: on v* tag build x86_64 and aarch64 glibc bundles with SHA256SUMS
- README: C integration, linking (-lstdc++), glibc notes; fix doctest snippets with ignore

Co-authored-by: LycanW <LycanW@users.noreply.github.com>
Co-authored-by: LycanW <LycanW@users.noreply.github.com>
Co-authored-by: LycanW <LycanW@users.noreply.github.com>
Co-authored-by: LycanW <LycanW@users.noreply.github.com>
…API guide

- tutorial_node: poll get_dynamic_json, parse prefix/interval, publish_raw + try_recv_raw
- CMake: rcos_tutorial_c target, link stdc++ for C programs, prefer gcc for C
- README: integration order, dynamic hot-reload notes, two-example table, self-test steps

Co-authored-by: LycanW <LycanW@users.noreply.github.com>
Co-authored-by: LycanW <LycanW@users.noreply.github.com>
- Replace serde_json with toml::to_string for C consumers so format matches config files
- Rename API from get_dynamic_json to get_dynamic_toml; update header, smoke test, examples, README

Co-authored-by: LycanW <LycanW@users.noreply.github.com>
… snapshot

Co-authored-by: LycanW <LycanW@users.noreply.github.com>
@cursor cursor Bot merged commit e4fcb6b into master Apr 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants