wazero

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2025 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ArduinoInstantiate

func ArduinoInstantiate(ctx context.Context, rt wazero.Runtime) (api.Closer, error)

func AsExitError

func AsExitError(err error) (exitCode int, ok bool)

func HasUnknownImportFunc added in v0.16.0

func HasUnknownImportFunc(wasmBytes []byte) bool

是否包含用户自定义的宿主函数

func JsInstantiate added in v0.9.0

func JsInstantiate(ctx context.Context, rt wazero.Runtime) (api.Closer, error)

func ReadImportModuleName added in v0.17.0

func ReadImportModuleName(wasmBytes []byte) (string, error)

判断目标类型

func RunWasm

func RunWasm(wasmName string, wasmBytes []byte, mainFunc string, wasmArgs ...string) (stdout, stderr []byte, err error)

单次执行 wasm

func UnknownInstantiate added in v0.9.0

func UnknownInstantiate(ctx context.Context, rt wazero.Runtime) (api.Closer, error)

func WasiInstantiate

func WasiInstantiate(ctx context.Context, rt wazero.Runtime) (api.Closer, error)

Types

type Module

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

wasm 模块, 可多次执行

func BuildModule

func BuildModule(wasmName string, wasmBytes []byte, wasmArgs ...string) (*Module, error)

构建模块(会执行编译)

func (*Module) Close

func (p *Module) Close() error

关闭模块

func (*Module) RunFunc

func (p *Module) RunFunc(name string, args ...uint64) (result []uint64, stdout, stderr []byte, err error)

执行指定函数(init会被强制执行一次)

func (*Module) RunMain

func (p *Module) RunMain(mainFunc string) (stdout, stderr []byte, err error)

执行初始化, 仅执行一次

Jump to

Keyboard shortcuts

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