Standard Library · ffi
attribute export
Exports a Leviathan function to C under a C symbol.
since 0.1.0-alpha.1linuxwindowswasm
Overview
The function needs a body, may not be generic or a method, and its signature must use only types that cross the C boundary. The symbol may not start with lv (the runtime's own namespace).
Examples
Exporting a function
uses ffi;
use io::console;
@export("lev_area")
int32 area(int32 w, int32 h) => w * h;
console.writeln(area(6, 7));
42
Fields
symbol
string symbolThe C symbol; empty means the function's own name.