Files
sx/examples/94-foreign-global.sx
2026-05-18 17:40:10 +03:00

15 lines
440 B
Plaintext

// Extern data globals via `<name> : <type> #foreign;`. Lets sx code
// reference libSystem / framework symbols (NSConcreteStackBlock,
// __stdinp, etc.) for FFI bridges. Mirrors the long-standing
// `<fn> :: (...) -> ... #foreign;` form on the function side.
#import "modules/std.sx";
__stdinp : *void #foreign;
main :: () -> s32 {
addr_bits : u64 = xx @__stdinp;
print("stdin extern global non-null: {}\n", addr_bits != 0);
0;
}