import_decl.c (787B)
1 /* Backend import-emission smoke fixture. 2 * 3 * `extern int host_add(int, int)` becomes a wasm `(import ...)` declaration 4 * once subagent B's backend changes land. Default module/field policy is 5 * `env` / `<sym name>`, so the produced module must contain 6 * (import "env" "host_add" (func (param i32 i32) (result i32))) 7 * 8 * Round-trip: when the produced `.wasm` is loaded back into kit's runtime 9 * and `host_add` is bound to a C function that returns a + b, main returns 5. 10 * 11 * Compile with: 12 * kit cc -target wasm32-none -c test/wasm-target/import_decl.c \ 13 * -o build/test/wasm-target/import_decl.wasm 14 * 15 * Inspect with: 16 * xxd build/test/wasm-target/import_decl.wasm | grep -F 'host_add' 17 */ 18 extern int host_add(int, int); 19 20 int main(void) { return host_add(2, 3); }