# echo — CBOR-free (`abi = c`) C bindings Generated by `nimble genbindings_c_abi_echo`, this is the **pure C ABI** rendering of the echo library, meant to be read side-by-side with the CBOR rendering in [`../c_bindings/`](../c_bindings/) (issue #105). Both come from the single `c` target (`-d:targetLang=c`); the library's `defaultABIFormat` picks the shape. | | `../c_bindings/` (`abi = cbor`) | this dir (`abi = c`) | |---|---|---| | Wire format on the C side | CBOR | native C structs (no serialization) | | Third-party dependency | vendored TinyCBOR | none | | Files | `echo.h` + `nim_ffi_cbor.h` + `nim_ffi_prelude.h` | one self-contained `echo.h` | | String type | `NimFfiStr` (owned) | `const char*` (borrowed for the call) | Both talk to the *same* unmodified Nim dylib API shape (`echo_ctx_create`, `echo_ctx_shout`, …) and share the async, binding-owned callback contract. The difference is only the ABI at the boundary: here the macro-generated `_CWire` structs (`ShoutRequest { const char* text; }`, …) are passed as native C structs and the Nim side converts them to/from Nim objects. CBOR is still used, but only as an internal transport between the exported wrapper and the FFI worker thread — it never appears in this header. The library is built with `-d:ffiEchoAbiC`, which flips the shared `examples/echo/echo.nim` source to `declareLibrary(..., defaultABIFormat = "c")`. A library that always wants the C ABI would set that in its own `declareLibrary` call and need no extra flag. Run the end-to-end test with `nimble test_c_abi_e2e`.