Files
sx/examples/comptime/0637-comptime-extern-slice-arg.sx
agra 66bdc70bf1 test: group examples into per-category folders
Move examples/*.sx and their expected/ snapshots into per-category
subfolders (examples/<category>/...). Folder = leading filename token,
with ffi-objc/ffi-jni kept whole; filenames are unchanged. The corpus
runner and LSP sweep now discover each category's expected/ dir, while
issues/ stays flat. Example 1058's repo-root-relative companion import
is made file-relative. Path strings embedded in 164 snapshots were
regenerated (path-only changes). Test-layout docs in CLAUDE.md updated.
2026-06-21 14:41:34 +03:00

15 lines
513 B
Plaintext

// Comptime host-FFI with a SLICE argument: a `#run` calling a libc function whose
// parameter is a `[:0]u8` (a `{ptr,len}` fat pointer), not a bare `cstring`. The VM
// marshals the fat pointer to a NUL-terminated `char*` before the call (Phase 4D.2),
// mirroring the legacy interpreter. (A bare `cstring` arg already passes as a word.)
#import "modules/std.sx";
strlen :: (s: [:0]u8) -> usize extern libc;
LEN :: #run strlen("hello, world");
main :: () -> i32 {
print("len={}\n", LEN);
return 0;
}