Stream: wasmtime

Topic: How to extract the function name from a callback


view this post on Zulip Sammy Hamdani (Apr 10 2025 at 19:48):

In my code, I assign the imports dynamically, all leading to the same function which dynamically handles the arguments. (I am using the C API, but I also can't find a way to do it in rust)
Since the function is dynamically assigned, multiple imports from the WASM file all lead to the same functions.
I would like to somehow be able to get the current external function name inside the callback so that I can tell different imports apart, however, I cannot find any way to do that. The Caller object does not seem to have any function that can do it any there also does not seem to be any way to easily implement it myself.
Does anyone know how I could achieve this?

view this post on Zulip Alex Crichton (Apr 10 2025 at 19:54):

This can't be done with Wasmtime's API, you'll have to attach state-per-callback instead


Last updated: Dec 06 2025 at 06:05 UTC