kit

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

import_decl_attribute.c (602B)


      1 /* Backend import-emission attribute-override fixture.
      2  *
      3  * `__attribute__((import_module("custom"), import_name("add")))` overrides
      4  * the default (env / <sym name>) module-and-field pair. After subagent B's
      5  * backend changes land, the produced module must contain
      6  *   (import "custom" "add" (func (param i32 i32) (result i32)))
      7  * Same calling convention as `import_decl.c`; round-trip returns 5 when
      8  * `custom.add` is bound to a sum-of-args host function.
      9  */
     10 __attribute__((import_module("custom"), import_name("add"))) extern int
     11 host_add(int, int);
     12 
     13 int main(void) { return host_add(2, 3); }