src/: ~21 capital-Foreign comments the case-sensitive verify grep missed (Foreign-class→Runtime-class, Foreign path→Runtime path, Foreign decls→Extern decls, FOREIGN function→extern function) across calls/inst/ffi_objc/jni_descriptor/emit_llvm/ c_import/lower.*/ops. src 'foreign' now = ONLY the hash_foreign token + 4 rejection messages (9.0-delete targets). examples/*.sx comments → extern/runtime-class (1219 stdout regen; KEPT 1176). docs/inline-asm-design + debugger purged. Comments only — no build impact. 9.0 ratified: DELETE hash_foreign token next.
17 lines
462 B
Plaintext
17 lines
462 B
Plaintext
// `callconv(.c)` on function pointers passed to extern callbacks — ensures
|
|
// the function uses C ABI so it can be safely invoked from `extern`
|
|
// functions like SDL_AddEventWatch.
|
|
|
|
#import "modules/std.sx";
|
|
|
|
// A function with C calling convention
|
|
add_c :: (a: i64, b: i64) -> i64 callconv(.c) {
|
|
a + b
|
|
}
|
|
|
|
main :: () {
|
|
// Call it directly — should work like any other function
|
|
result := add_c(10, 32);
|
|
print("callconv(.c): {}\n", result);
|
|
}
|