fixes
This commit is contained in:
17
examples/issue-0016.sx
Normal file
17
examples/issue-0016.sx
Normal 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);
|
||||
}
|
||||
Reference in New Issue
Block a user