Stream: general

Topic: Golang: how to use linear memroy


view this post on Zulip AndreaEsposit (Jan 19 2021 at 12:42):

Hey, I am not sure if I can even ask questions here, but I have been struggling a lot and don't know any other place where to ask.. (tried already on Reddit and on stack)

(from a Go program) I have been trying to pass strings/arrays to a Rust lib (compiled to wasm), however for what I understood, right now there is no way to pass them directly, so I have to use the WebAssembly memory. Unfortunately I haven't found anywhere any example, does anyone know how to do it?

I am sorry for my poor English. Any reply will help, thanks in advance.

view this post on Zulip AndreaEsposit (Jan 19 2021 at 20:59):

Alright, I have made a function (takes usize) in lib.rs to allocate memory in the webassembly module that returns a pointer so that the runtime can write data at this offset. Does anyone know how to do this from Go?

I have found multiple examples in Rust/C, but none in Go

view this post on Zulip AndreaEsposit (Jan 19 2021 at 23:59):

I found a solution! Sorry for the bother


Last updated: Nov 22 2024 at 16:03 UTC