Vendored MoonBit prebuilt artifacts#
These files let the kernel build without the MoonBit (moon) toolchain whenmake MOONBIT_PREBUILT=1 is used (the native Windows build path; seeservices/backend/src/cli/handlers/khyos.js). In the default build they are NOT used —make regenerates build/moonbit_gen.c via moon build as before.
Contents#
| File | Source | Purpose |
|---|---|---|
moonbit_gen.c | generated by moon build --target native then main()→moonbit_entry() sed (see kernel/Makefile moonbit-build) | the MoonBit module compiled to C |
runtime.c | ~/.moon/lib/runtime.c | MoonBit C runtime |
include/moonbit.h | ~/.moon/include/moonbit.h | runtime header |
include/moonbit-fundamental.h | ~/.moon/include/moonbit-fundamental.h | the only header moonbit.h pulls in under -DMOONBIT_NATIVE_NO_SYS_HEADER |
-DMOONBIT_NATIVE_NO_SYS_HEADER (already in MOONBIT_CFLAGS) gates off every system
include in runtime.c (stdio.h, windows.h, backtrace.h, …), so this 3-file set is
fully self-contained for a freestanding build. backtrace.h is NOT required
(gated behind MOONBIT_ALLOW_STACKTRACE, which is not defined).
Version pin (ABI invariant)#
moonbit_gen.c and runtime.c/headers MUST come from the same MoonBit release —
a mismatch can break the ABI between the generated C and the runtime.
Generated with:
moon 0.1.20260427 (48d7def 2026-04-27)
Regenerating (maintainers)#
After changing kernel/moonbit/**, regenerate and refresh these files:
cd kernel && make moonbit-build # writes build/moonbit_gen.c
cp build/moonbit_gen.c vendor/moonbit/moonbit_gen.c
cp ~/.moon/lib/runtime.c vendor/moonbit/runtime.c
cp ~/.moon/include/moonbit.h vendor/moonbit/include/moonbit.h
cp ~/.moon/include/moonbit-fundamental.h vendor/moonbit/include/moonbit-fundamental.h
Update the version pin above to the moon version that produced them.