Files
sx/library/modules/std/build.sx
agra 44dfdcddf9 P5.2 metadata queries: c_object_paths / link_libraries on the VM
Two abi(.compiler) build-pipeline primitives the sx driver will pass to link:
- c_object_paths() -> List(string)  (#import c companion objects)
- link_libraries() -> List(string)  (#library names)

They live in a new stdlib home library/modules/std/build.sx and are serviced
by comptime_vm.callCompilerFn reading two new BuildConfig fields that main.zig
forwards before the post-link callback. New reusable VM helper makeStringList
builds a List(string) in flat memory from the call's result type offsets
(target-aware); invoke/callCompilerFn now thread ins.ty for that. Legacy
handlers bail loudly (VM-only by nature — post-link; List(string) isn't
faithfully buildable in the legacy Value model, 0141).

Smoke test examples/1662-platform-build-pipeline-queries (AOT + a 1-line C
#source → one object): a post-link callback verifies the VM-built list is
well-formed; build exit 0 only if so (negative-probe confirmed a real guard).

emit_object + link (the actions) deferred to P5.2b — they replace the Zig
driver's auto-emit/auto-link and need a host-installed callback vtable.

703/0 both gates.
2026-06-19 07:42:27 +03:00

18 lines
934 B
Plaintext

// Phase 5 — sx-driven build pipeline (compiler primitives).
//
// These run in the comptime evaluator (`abi(.compiler)`), serviced by
// `comptime_vm.callCompilerFn`. They are called from the post-link build driver
// (a callback registered via `set_post_link_callback`), which always runs on the
// comptime VM (`core.invokeByFuncId`) — the VM, unlike the legacy interpreter,
// can allocate/grow the `List`s the driver builds (issue 0141).
//
// This is the home the sx `default_build` pipeline grows into; for now it exposes
// the read-only build metadata queries.
#import "modules/std.sx";
// The C companion object files for this build (`#import c { #source ... }`,
// compiled to `.o`) and the `#library` link names. The sx driver passes them to
// the linker. Answered from the compiler's accumulated build state.
c_object_paths :: () -> List(string) abi(.compiler);
link_libraries :: () -> List(string) abi(.compiler);