Skip to content
Leonard Ramminger edited this page Aug 31, 2026 · 1 revision

C FFI

The ffi feature exposes a C ABI documented in ycallr.h (generated by cbindgen in CI).

Build

cargo build --features ffi

Regenerate the header:

cargo build --features ffi
cbindgen --crate ycallr-core -l c -o ycallr.h

Main entry points

Symbol Purpose
ycallr_parse_yaml Parse YAML at compile or debug time
ycallr_install_yaml_file Install profile from YAML path
ycallr_load_installed Load installed .pb by name
ycallr_parse_proto Load from protobuf bytes
ycallr_client_new Create HTTP client
ycallr_call Execute command
ycallr_set_base_url Override base URL at runtime
ycallr_get_last_error Thread-local error string

Error handling

Functions return null or negative codes on failure. Read ycallr_get_last_error() for details.

Strings returned by the API must be freed with ycallr_string_free when documented as owned.

Safe helpers (Rust)

c_string_to_str(ptr) decodes NUL-terminated FFI return pointers into Option<String> without exposing raw pointer rules to callers.

Consumers

  • ycallr-cli (thin FFI frontend)
  • C, Go, Python, or other languages via the same header

The CLI does not call YcallrClient directly; it only uses symbols from ycallr.h.

Clone this wiki locally