wasmer icon indicating copy to clipboard operation
wasmer copied to clipboard

How can I access shared memory within an imported function?

Open john01dav opened this issue 1 year ago • 3 comments

In order to do most interesting things it is necessary to have an ABI that allows imported functions to read shared memory. For example, if the WASM code wants to pass a string to the host code it can give a pointer and length, which the host code can then read within the body of the imported function. But, when I am trying to write this, I am running into an issue. In order to get a MemoryView I need a & reference to the store, but I need to give a &mut reference to the store in Function::call or TypedFunction::call, which precludes having this & reference. How can I implement such an ABI?

john01dav avatar Jun 11 '23 03:06 john01dav