mirror of
https://github.com/logos-messaging/libchat.git
synced 2026-04-02 01:23:11 +00:00
Implement a `client` crate that wraps the `libchat` context behind a simple `ChatClient<D>` API. The delivery strategy is pluggable via a `DeliveryService` trait, with two implementations provided: - `InProcessDelivery` — shared `MessageBus` for single-process tests - `CDelivery` — C function-pointer callback for the FFI layer Add a `client-ffi` crate that exposes the client as a C API via `safer-ffi`. A `generate-headers` binary produces the companion C header. Include two runnable examples: - `examples/in-process` — Alice/Bob exchange using in-process delivery - `examples/c-ffi` — same exchange written entirely in C; smoketested under valgrind (to catch memory leaks) in CI iterates: #71
c-client
An example C application built on top of crates/client-ffi.
It demonstrates that the C ABI exposed by crates/client-ffi is straightforward to
consume from plain C — or from any language that can call into a C ABI. No Rust code,
no Cargo project: just a C source file linked against the pre-built static library.
Building and running
make # builds client-ffi with Cargo, then compiles src/main.c
make run # build + execute
make clean # remove the compiled binary
For a release build:
make CARGO_PROFILE=release