// Comptime compiler API — a layout-welded struct binding. // // `Field :: struct abi(.zig) extern compiler { … }` binds the sx struct to the // compiler's real internal Zig type (`StructInfo.Field`, two u32s) via the // `compiler` library. The compiler validates the sx declaration against the // welded type's layout at registration time (the sx side is a header checked // against the implementation) — a faithful declaration validates clean and the // struct is otherwise ordinary data. The `compiler` library is the comptime-only // internal surface, so `#library "compiler"` is NOT dlopen'd. // // Phase 1 (foundation): the weld is layout-validated; field offsets coincide with // the natural layout for `Field` (two u32s). Welded host-call functions land in a // later phase. #import "modules/std.sx"; compiler :: #library "compiler"; Field :: struct abi(.zig) extern compiler { name: u32; ty: u32; } main :: () { f := Field.{ name = 7, ty = 3 }; print("name={} ty={}\n", f.name, f.ty); }