gowasmer

package module
v0.0.0-...-c6596a8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 8, 2024 License: MIT Imports: 9 Imported by: 0

README

gowasmer

gowasmer

When compiling Go to WebAssembly, the Go compiler assumes the WebAssembly is going to run in a JavaScript environment. Hence a wasm_exec.js file is provided by the Go compiler and must be used. However, WebAssembly can actually run everywhere. So we need to use some hacks to make WebAssembly modules generated by the Go compiler runnable everywhere. And that's where gowasmer is useful.

gowasmer is a port of the wasm_exec.js file, for Go. It assumes the WebAssembly runtime is wasmer-go.

Alternatively, to avoid using gowasmer, you can compile your Go program to WebAssembly with TinyGo as follows:

$ tinygo build -o module.wasm -target wasi .

Usage

See _example directory.

Installation

$ go get github.com/mattn/gowasmer

License

MIT

Author

Yasuhiro Matsumoto (a.k.a. mattn)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GoInstance

type GoInstance struct {
	// contains filtered or unexported fields
}

GoInstance is instance of Go Runtime.

func NewInstance

func NewInstance(b []byte) (*GoInstance, error)

NewInstance create instance of GoRuntime.

func (*GoInstance) Get

func (d *GoInstance) Get(name string) interface{}

Get return Go value specified by name

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL