News for hackers. Stuff that matters.
Re:Wasmer 2.0 by rad_gruchalski on Thursday June 17, 2021 @12:17PM (#27541311)
Looks awesome. Any examples for calling host golang functions?
Re:Wasmer 2.0 by syrusakbary on Thursday June 17, 2021 @12:34PM (#27541499)
I'd recommend to check Wasmer Go integration [1].

More specifically, here's how you can call Go host functions: https://github.com/wasmerio/wasmer-go/blob/master/examples/e...

[1] https://github.com/wasmerio/wasmer-go

Re:Wasmer 2.0 by irq-1 on Thursday June 17, 2021 @03:54PM (#27543866)
NB: there's no passing strings to/from the wasm vm.
Re:Wasmer 2.0 by rad_gruchalski on Thursday June 17, 2021 @05:51PM (#27544836)
But byte arrays would work?
Re:Wasmer 2.0 by Hywan on Friday June 18, 2021 @04:26AM (#27548457)
WebAssembly only supports i32, i64, f32, and f64 for the moment. So you need to allocate the string manually inside the Wasm memory, then pass the pointer of that string to the Wasm function.

I will add an example to showcase that, many people are asking this :-).

Re:Wasmer 2.0 by irq-1 on Friday June 18, 2021 @02:41PM (#27553479)
Thanks for your work on wasmer-go.

Would it be possible to make go functions that wrap string passing, and add them to the go api? Is freeing the memory manually inside the wasm vm something that can be delegated to the vm?

Re:Wasmer 2.0 by rad_gruchalski on Sunday June 20, 2021 @12:06PM (#27571384)
This would be awesome! Thank you.