Skip to content

Create Wasm globals from C code? #12793

Description

@juj

I would like to define WebAssembly globals in C code, something like

int __attribute__((wasm_global)) myGlobal = 5;

that would then emit a

(global $myGlobal i32 (i32.const 5))

into the build. Setting and reading the variable would then emit global.get and global.set, and taking an address &myGlobal would then be forbidden at compile time. Is there a way to do that today, or would it be possible to add?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions