diff --git a/library/modules/std/core.sx b/library/modules/std/core.sx index ce6fa5d8..17eddf2e 100644 --- a/library/modules/std/core.sx +++ b/library/modules/std/core.sx @@ -4,6 +4,13 @@ // never import this file directly — std.sx re-exports every name here. Vector :: ($N: int, $T: Type) -> Type #builtin; +// The C library, declared HERE because core.sx owns the libc escape hatches +// (`libc_write`/`libc_malloc`/`libc_free`/`memcpy`/`memset` below). `#library` +// constants are program-global and dedup, so this is harmless when other std +// modules (socket/fs/cli) also declare it — and it makes core.sx (hence +// list.sx, which imports core for `Allocator`/`List`) self-contained, so they +// can be imported without assembling the whole std prelude. +libc :: #library "c"; // `out` writes a string straight to fd 1 via libc `write` — a plain sx function, // NOT a compiler builtin. At comptime it runs through the evaluator's host-FFI // escape (the VM's dlsym path / the interp's extern call); at runtime it's an