LEVIATHAN vd52e79c4 · d52e79c486

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 symbol

The C symbol; empty means the function's own name.