Files
sx/examples/issue-0016.sx
2026-03-05 16:20:36 +02:00

18 lines
510 B
Plaintext

// issue-0016: C calling convention for function pointers passed to foreign callbacks.
//
// `callconv(.c)` ensures the function uses C ABI, so it can be safely
// passed as a callback to #foreign functions like SDL_AddEventWatch.
#import "modules/std.sx";
// A function with C calling convention
add_c :: (a: s64, b: s64) -> s64 callconv(.c) {
a + b;
}
main :: () {
// Call it directly — should work like any other function
result := add_c(10, 32);
print("callconv(.c): {}\n", result);
}