wasmerio / wasmer-go

🐹🕸️ WebAssembly runtime for Go

Home Page:https://pkg.go.dev/github.com/wasmerio/wasmer-go

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

HBrightShown opened this issue · comments

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?