Files
sx/examples/1231-ffi-extern-undeclared-lib.sx
agra 9719432e79 refactor(ffi-linkage): Phase 9.3 — purge remaining 'foreign' from library/docs/example comments
Capital-Foreign + stale-identifier comment refs: library (Foreign Java types→Runtime,
foreign-class→runtime-class, foreign_class_map→runtime_class_map); docs/debugger
(foreign call→extern call); docs/fork-c ledger (foreign_class_map, protocol/foreign→
runtime-class); docs/inline-asm-design Deviation-6 obsolete #foreign-vs-extern design
RESOLVED to the landed extern/export reality; example comments (parseForeignClassDecl→
parseRuntimeClassDecl, checkForeignRefs→checkExternRefs, Foreign decls→Extern). Docs/
comments only — no build impact.
2026-06-15 11:03:29 +03:00

20 lines
861 B
Plaintext

// An `extern LIB "csym"` reference must name something real, exactly like
// its `extern LIB` twin (example 1620): `nosuchunit` names neither a
// #library constant nor a named `#import c` unit, so this is a compile-time
// diagnostic — the bogus library reference is caught BEFORE the symbol
// would silently resolve through whatever image happens to carry it.
//
// Regression (FFI-linkage Part B): `checkExternRefs` validated only a
// `extern` (extern-import shape) library_ref and skipped the `extern` keyword's
// `extern_lib`, so a bogus `extern` lib reference compiled silently (the
// symbol resolved via the default image and ran). Prerequisite for
// migrating the fn-decl `extern` path onto `extern`.
#import "modules/std.sx";
c_abs :: (n: i32) -> i32 extern nosuchunit "abs";
main :: () -> i32 {
print("c_abs = {}\n", c_abs(-5));
0
}