Files
sx/examples/1621-cimport-shadow-os-lib.sx
agra 0bd8f3e5ce feat(C2): unit-first JIT symbol resolution — program-owned dylibs beat process images
runJITFromObject now takes priority dylibs (the #import c unit's
linked objects first, then #library deps in declaration order) and
attaches a per-path search generator for each AHEAD of the
process-wide fallback, so a vendored symbol can never lose to a
same-named export of an image the host process happens to carry
(libz via LLVM, libsqlite3 via CoreServices). loadLibrary reports
the name dlopen succeeded on; the c-import handle records its dylib
path; temp link inputs are per-pid so concurrent runs can't clobber
each other. Flips the C0.3 shadowing pin to from_unit: true.
2026-06-12 16:56:35 +03:00

19 lines
711 B
Plaintext

// Unit-first JIT resolution (PLAN-C C2): a `#source` unit defining a
// symbol that ALSO lives in an OS image already loaded into the
// compiler process (libz, via libLLVM) still wins — the unit's dylib
// is a priority symbol-search target ahead of the process-wide
// fallback. The unit's zlibCompileFlags answers 0xDEADBEEF; the OS
// one answers real flag bits, so `true` proves the unit won.
// Regression (PLAN-C C0.3 xfail, flipped by C2.1).
#import "modules/std.sx";
zshadow :: #import c {
#include "1621-cimport-shadow-os-lib/shadow.h";
#source "1621-cimport-shadow-os-lib/shadow.c";
};
main :: () -> i32 {
print("from_unit: {}\n", zshadow.zlibCompileFlags() == 3735928559);
0
}