Skip to content

docs(examples): native (same-process) C++ example#61

Draft
Ivansete-status wants to merge 1 commit into
ffi-native-typed-returnsfrom
cpp-native-example
Draft

docs(examples): native (same-process) C++ example#61
Ivansete-status wants to merge 1 commit into
ffi-native-typed-returnsfrom
cpp-native-example

Conversation

@Ivansete-status

Copy link
Copy Markdown
Collaborator

Adds the native C++ example to sit alongside the existing CBOR C++ bindings,
so C++ has both ABIs covered (as requested). Based on the native-FFI stack (#58)
for typed struct returns.

What

  • examples/timer/cpp_native/ — a C++ program that links the library and calls
    the native <name> ABI directly: {.ffi.} structs by value in, typed
    EchoResponse struct out (read in the callback). No CBOR, no tinycbor. An RAII
    TimerNode wrapper bridges the async FFI-thread callback to a synchronous API
    with std::future.

Native vs CBOR C++ (now both present)

Example ABI For
cpp_native/ (new) native <name> same-process / local
cpp_bindings/ CBOR <name>_cbor inter-process

Validation

Builds and runs end-to-end (make run): version + typed echo round-trip.

Note: PR #55 carries a companion fix pointing the CBOR C++ generator at the
<name>_cbor symbols (it was calling the native symbol with CBOR args after
the ABI split — that had reddened the C++ e2e). With both, the CBOR and native
C++ paths work side by side.

🤖 Generated with Claude Code

Complements the CBOR C++ bindings (../cpp_bindings) with the native path: a C++
program that links the library and calls the native `<name>` ABI directly,
passing {.ffi.} structs by value and reading typed struct returns
(EchoResponse) from the callback — no CBOR, no tinycbor. An RAII TimerNode
wrapper bridges the async FFI-thread callback to a synchronous API via
std::future. README spells out native (same-process) vs CBOR (IPC). Verified
end-to-end with `make run`.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@Ivansete-status
Ivansete-status force-pushed the ffi-native-typed-returns branch from 1060340 to c000a84 Compare May 31, 2026 16:38
@Ivansete-status
Ivansete-status marked this pull request as draft June 1, 2026 07:34
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.

1 participant