- objc.sx, objc_block.sx (from std/) + sdl3/opengl/raylib/stb/stb_truetype/ wasm vendor bindings (from modules/ root) -> modules/ffi/ - std/uikit.sx deleted: platform/uikit.sx already declares UIApplicationMain and imports objc; '#framework "UIKit"' cannot live in a file imported on macOS targets (unconditional link directive, UIKit is iOS-only), so the three iOS-only examples carry the 3-line glue inline. 1607/1608/1616 also un-rotted (dead ns_string -> 'xx "..."' Into conversions, callconv(.c) msgSend fn-ptrs) — all three build for ios-sim/ios again. - math/math.sx -> math/scalar.sx; one spelling '#import "modules/math"' everywhere (4 pinned IR snapshots regenerated: dir import adds Vec2/Mat4 to the type tables). - compiler.sx -> build.sx (imports, CLAUDE.md bundling table, specs.md). - testpkg/ + test_c.sx -> tests/fixtures/ (resolve CWD-relative from repo root, same as vendors/). - library-internal imports use full modules/... paths (std.sx tail, platform/bundle.sx, fixtures).
29 lines
1.1 KiB
Plaintext
29 lines
1.1 KiB
Plaintext
// Generic `Into(Block)` impl with a `string`-typed arg in the
|
|
// closure signature. The block trampoline declares the param with
|
|
// callconv(.c); without the abi-collapse fix, sx `string` got
|
|
// silently collapsed to `ptr` (the libc `char *` heuristic) and
|
|
// the caller's 16-byte `{ptr, len}` value mismatched the
|
|
// trampoline's 8-byte `ptr` slot. Result: segfault inside the
|
|
// trampoline's first read.
|
|
//
|
|
// The fix lives in `abiCoerceParamTypeEx`: the `string`/`slice` →
|
|
// `ptr` collapse only applies to `is_extern` foreign decls (libc
|
|
// interop). sx-internal `callconv(.c)` keeps the full slice
|
|
// shape, which lands as `[2 x i64]` at the LLVM signature site
|
|
// and matches the caller's two-register pass on AArch64.
|
|
|
|
#import "modules/std.sx";
|
|
#import "modules/ffi/objc_block.sx";
|
|
|
|
g_s: string = "";
|
|
|
|
main :: () -> s32 {
|
|
cl := (s: string) => { g_s = s; };
|
|
b : Block = xx cl;
|
|
invoke_fn : (*Block, string) -> void callconv(.c) = xx b.invoke;
|
|
invoke_fn(@b, "hello");
|
|
if g_s.len == 0 { print("FAIL: empty\n"); return 1; }
|
|
print("got: <{}>\n", g_s);
|
|
0
|
|
}
|