Stream: git-wasmtime

Topic: wasmtime / Issue #2728 Fetch context data from `Caller` i...


view this post on Zulip Wasmtime GitHub notifications bot (Mar 15 2021 at 17:32):

davxy opened Issue #2728:

Hi there, I'm using your Rust implementation.

I'm having hard times trying to pass a structure reference from the host (before entering the wasm) to a host function (called from the wasm).

The idea is to be able to fetch a reference to the data once I'm in the host function callback (actually a solution can be pass the data as a serialized byte array, but that option has been excluded for performance reasons).

Is there a way to attach a reference to my structure to the Caller structure that I receive in the host function?

I think that the issue has already being partially covered by #2491 (using lambdas) . But I was wandering if some other alternative method is available.

Thank you so much for your awesome work

view this post on Zulip Wasmtime GitHub notifications bot (Mar 15 2021 at 17:50):

fitzgen commented on Issue #2728:

The next release of wasmtime will let you configure Store-specific context data, and you can get the Store from a Caller:

view this post on Zulip Wasmtime GitHub notifications bot (Mar 16 2021 at 06:12):

davxy commented on Issue #2728:

Awesome!!!

Just to know how to move with my project (i.e. wait for the release or make a temporary hack). When do you think that the new version will be published on crates.io?
No pressure :-)

Thanks a lot

view this post on Zulip Wasmtime GitHub notifications bot (Mar 16 2021 at 06:24):

davxy edited Issue #2728:

Hi there, I'm using your Rust implementation.

I'm having hard times trying to pass a structure reference from the host (before entering the wasm) to a host function (called from the wasm).

The idea is to be able to fetch a reference to the data once I'm in the host function callback (actually a solution can be pass the data as a serialized byte array, but that option has been excluded for performance reasons).

Is there a way to attach a reference to my structure to the Caller structure that I receive in the host function?

I think that the issue has already being partially covered by #2491 (using lambdas) . But I was wandering if some other alternative method is available.

Thank you so much for your awesome work

view this post on Zulip Wasmtime GitHub notifications bot (Mar 16 2021 at 16:54):

fitzgen commented on Issue #2728:

I'll double check with the team to see if there's anything we need to finish up first before we can cut a new release.

In the meantime, you can add this to your Cargo.toml:

[patch.crates-io]
wasmtime = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "main" }
# And do the same for any other wasmtime crates you're using that need to be
# the same version, eg `wasmtime-wasi`

view this post on Zulip Wasmtime GitHub notifications bot (Mar 16 2021 at 20:29):

fitzgen commented on Issue #2728:

wasmtime 0.25.0 is now published on crates.io: https://crates.io/crates/wasmtime/0.25.0

view this post on Zulip Wasmtime GitHub notifications bot (Mar 16 2021 at 20:29):

fitzgen closed Issue #2728:

Hi there, I'm using your Rust implementation.

I'm having hard times trying to pass a structure reference from the host (before entering the wasm) to a host function (called from the wasm).

The idea is to be able to fetch a reference to the data once I'm in the host function callback (actually a solution can be pass the data as a serialized byte array, but that option has been excluded for performance reasons).

Is there a way to attach a reference to my structure to the Caller structure that I receive in the host function?

I think that the issue has already being partially covered by #2491 (using lambdas) . But I was wandering if some other alternative method is available.

Thank you so much for your awesome work


Last updated: Nov 22 2024 at 16:03 UTC