Skip to main content
iroh-c-ffi is a raw C API generated with safer-ffi — unlike the Python, Swift, Kotlin, and JavaScript bindings, it isn’t built on iroh-ffi/uniffi. There are no prebuilt binaries; you build the static/shared library from source and link against it.

Install

This produces target/release/libiroh_c_ffi.{a,so,dylib}. The matching header is already checked in as irohnet.h; regenerate it only if you’re tracking an API change:

Hello, iroh

Build and link against the library from the previous step:
This binds an endpoint with a single ALPN, waits up to 5 seconds for a home relay, and prints the endpoint id. See the CI workflow for the extra link flags Windows needs.

Next steps

main.c example

A full server/client pair: bind, accept, send, and receive over uni- and bi-directional streams.

Multi-threaded examples

multi-thread-server.c, multi-thread-client.c, and single-thread-server.c for handling concurrent connections.

iroh-c-ffi repository

Source, generated header, and issue tracker for the C bindings.