wasmerio / wasmer-go

🐹🕸️ WebAssembly runtime for Go
https://pkg.go.dev/github.com/wasmerio/wasmer-go
MIT License
2.8k stars 161 forks source link

How can i edit a program with golang and build it with tiny-go, then i can get wasm file? #390

Open HBrightShown opened 1 year ago

HBrightShown commented 1 year ago

I met a problem: I want to build a file to wasm file with golang, so how i cant communication with wasmer-go? I saw some example in wasmer-go, all example given like by follows:

wasmBytes := []byte(` (module (global $one (export "one") f32 (f32.const 1)) (global $some (export "some") (mut f32) (f32.const 0))

      (func (export "get_one") (result f32) (global.get $one))
      (func (export "get_some") (result f32) (global.get $some))

      (func (export "set_some") (param f32) (global.set $some (local.get 0))))
`)

so, how i write a golang file and build it ,then i get wasmBytes? Others, how i transfer string and struct parameter to this file?