Skip to content

Support for mutable Global in HostModuleBuilder #2332

@redexp

Description

@redexp

Good day

I have wasm file (compiled with emscripten) that instantiated with js code and I'm trying to do same thing with wazero and I'm stuck on part with new WebAssembly.Global(...)

WebAssembly.instantiateStreaming(source, {
  //...
  env: {
    __stack_pointer: new WebAssembly.Global({
          "value": "i32",
          "mutable": true
    }, 78112),
    _emscripten_get_now_is_monotonic: () => 1,
  },
})

I do not have problems with functions like _emscripten_get_now_is_monotonic I can add them like this

env.NewFunctionBuilder().
	WithFunc(func() int32 { return 1 }).
	Export("_emscripten_get_now_is_monotonic")

but how to add Global instead of function?

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