Extern
Extern declarations use external linkage: symbols resolve at link time by the system linker. Missing symbols fail the link step.
Functions
Section titled “Functions”extern fn without a body declares an imported symbol. Calls use the C calling convention:
extern fn malloc(usize) *void;extern fn free(*void);
fn main() { let ptr: *i32 = malloc(4); *ptr = 123; free(ptr);}extern fn with a body exports the symbol for native callers:
extern fn hello() { @println("hi from Zeen");}Varargs with ...:
extern fn printf([*]const char, ...);Variables
Section titled “Variables”extern let declares an imported global. Storage lives in native code, no value allowed:
extern let errno: i32;extern link appends native files after the compiled object in the link step:
extern link "helpers.c";Object-only toolchains skip these sources with a warning.
