Stream: wasi

Topic: How to extend WasiCtx


view this post on Zulip Daniel Blignaut (Jan 12 2023 at 10:03):

Hi,

I've added some custom host functions that require some change to the context object. Additionally I'm using the Wasi Snapshot. Is it possible to extend the WasiCtx struct to:

  1. Add additional attributes that I want to keep track of for my WASM module execution (e.g. an open socket)
  2. Implement functions (e.g. sock_open). I know this is possible by just adding impl sections but I'm unsure on how to add additional attributes as Rust doesn't support native inheritence.

I also can't copy paste the WasiCtx struct definition as it uses private crate references. Any help would be appreciated.

view this post on Zulip Daniel Blignaut (Jan 12 2023 at 17:32):

I've seen the add_to_linker function and how this assists however this uses a macro from wiggle which in turn uses .wit definitions to generate. Is there a way to define the add_to_linker without a .wit file? I'm manually doing it now but seems like a real pain


Last updated: Nov 22 2024 at 17:03 UTC