cawfree / react-native-webassembly

⚛️ 🏎 WebAssembly for React Native powered by JSI.
https://twitter.com/cawfree
MIT License
291 stars 6 forks source link

getting memory as [] instead of Memory instance #24

Open ieow opened 9 months ago

ieow commented 9 months ago

I am getting the memory as [] and memory.buffer as undefined when load in react-native (with react-native-webassembly). I am able to get the memory as Memory instance on nodejs enviroment

I am not sure if the wasm I used is using multiple memory region. would the multiple memory region causing this issue?

cawfree commented 9 months ago

Hey @ieow thanks for raising. Can you provide some example code so I could check this out?

Sounds like the buffer is likely not being initialized or exported correctly. Hard to say without more details.

ieow commented 9 months ago

I am trying to load this library https://github.com/torusresearch/tss-lib-rn/tree/demo/test-rn

code to load it

      import * as TssLibNode from '@toruslabs/tss-lib-rn';

      await TssLibNode.init();

      console.log(TssLib.wasmMod.exports.memory);
      console.log(TssLib.wasmMod.exports.memory.buffer);
      console.log(TssLib.wasmMod.memory);
cawfree commented 9 months ago

@ieow Thanks for sharing, I'll check this out. By the way, Torus is 🔥!

ieow commented 8 months ago

Thanks for the efforts and compliment !!!

ieow commented 8 months ago

@cawfree , just check out if you found the issue. Also I would like to point out that the wasm file is using import (global) js function. would this might be an issue ?

https://rustwasm.github.io/wasm-bindgen/examples/import-js.html