wasm_imports.h (917B)
1 #ifndef KIT_ARCH_WASM_IMPORTS_H 2 #define KIT_ARCH_WASM_IMPORTS_H 3 4 /* Side table keyed by C-level symbol name carrying wasm import overrides 5 * (`__attribute__((import_module(...), import_name(...)))`). Lives on the 6 * ObjBuilder under OBJ_EXT_WASM_IMPORTS — populated by the C frontend at 7 * decl_declare time, consumed by the wasm backend when promoting an 8 * undefined function symbol into a wasm `(import ...)` declaration. 9 * 10 * Either Sym may be 0; the backend treats 0 as "use default" (module="env", 11 * name=<linkage spelling>). */ 12 13 #include "obj/obj.h" 14 15 void wasm_imports_set(ObjBuilder* o, Sym name, Sym import_module, 16 Sym import_name); 17 18 /* Returns 1 and writes the import module/name out-params (each 0 when unset) 19 * when an entry exists; returns 0 otherwise. */ 20 int wasm_imports_get(const ObjBuilder* o, Sym name, Sym* import_module, 21 Sym* import_name); 22 23 #endif