wasm3
wasm3 copied to clipboard
API for import kind: global, memory, table?
Hi, I know there is a function m3_LinkRawFunction
to link an import function. But how can I link an import global, memory and table?
BTW, wasm3 is awesome! many thanks!
Thanks! The API at this point is rather minimal. As you've discovered, there is missing functionality for connecting to the outside world.
m3_SetGlobal
, m3_GetGlobal
API was added
Is there any new thinking on this issue? I understand m3_SetGlobal
and m3_GetGlobal
were added, but the actual memory is not shared. So if the wasm3 consumer is trying to share this global (or if it is shared across modules), it seems like the consumer would have to try to keep multiple copies of the data/memory in sync. It might be conceptually correct that the synchronization only needs to happen when crossing the boundary between the consuming native code and the wasm code, but that would mean both on wasm function returns and also wasm calls into the native hosting code, and the consuming code wouldn't know what globals were mutated by the wasm code so presumably the consuming code would have to copy the global values in all of these cases of crossing the boundary.
Is there a better way to deal with this now, or any plans to improve this? If changes to wasm3 are needed for this, is it as simple as allowing the global to have a pointer to an external 32/64 bit piece of memory (rather than the M3Global struct owning the memory)?