This commit is contained in:
agra
2026-03-05 16:20:36 +02:00
parent 22bc2439ce
commit f9dda972d2
36 changed files with 1063 additions and 7 deletions

17
examples/issue-0016.sx Normal file
View File

@@ -0,0 +1,17 @@
// 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);
}