OxL Reference

16.1 C

oxl
import c "zlib.h" { deflate, inflate, z_stream }
extern c fn getpid() -> i32
export c fn oxl_handle(req: *u8, len: usize) -> i32 { … }
  • import c reads a header through libclang at compile time. Type mapping: int → i32, size_t → usize, pointers → *T/*var T, structures → @c_layout data.
  • Calling an FFI function is only possible in unsafe. A safe wrapper is an ordinary function with unsafe inside.
  • export c fn exports a function with the C ABI; a panic at the boundary is turned into returning an error code and a log entry.

ffi-import

See also

Source: docs/spec/oxl-standard.en.md