kit

kit
git clone https://git.ryansepassi.com/git/kit.git
Log | Files | Refs | README

wasm_imports.h (1151B)


      1 #ifndef KIT_OBJ_WASM_IMPORTS_H
      2 #define KIT_OBJ_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  * generic ObjBuilder under OBJ_EXT_WASM_IMPORTS — populated target-neutrally
      7  * (the C frontend / CG session set it at decl time, before any backend
      8  * exists), consumed by the wasm backend when promoting an undefined function
      9  * symbol into a wasm `(import ...)` declaration. The setter is pure obj-layer
     10  * code (it only touches the obj side-table), so it lives here under src/obj
     11  * and is reachable without any dependency on the wasm backend.
     12  *
     13  * Either Sym may be 0; the backend treats 0 as "use default" (module="env",
     14  * name=<linkage spelling>). */
     15 
     16 #include "obj/obj.h"
     17 
     18 void wasm_imports_set(ObjBuilder* o, Sym name, Sym import_module,
     19                       Sym import_name);
     20 
     21 /* Returns 1 and writes the import module/name out-params (each 0 when unset)
     22  * when an entry exists; returns 0 otherwise. */
     23 int wasm_imports_get(const ObjBuilder* o, Sym name, Sym* import_module,
     24                      Sym* import_name);
     25 
     26 #endif