Files
sx/examples/platform/1611-platform-post-link-callback.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

27 lines
723 B
Plaintext

#import "modules/std.sx";
#import "modules/build.sx";
// Post-link callback registration. The compiler invokes `post_link`
// after `target.link()` returns (sx build). Under `sx run` (JIT) the
// callback is registered but never invoked because there's no link
// phase — so the only thing this example prints under the test
// runner is `runtime main`. The post-link path is exercised via
// `sx build` separately.
puts :: (s: [:0]u8) -> i32 extern libc;
post_link :: (opt: BuildOptions) -> bool abi(.compiler) {
puts("[post-link] callback fired");
true
}
configure :: () abi(.compiler) {
opts := build_options();
on_build(post_link);
}
#run configure();
main :: () {
print("runtime main\n");
}