Documentation ¶
Index ¶
- Variables
- func DefineFunc(l *Linker, modName, funcName string, f func()) error
- func DefineFunc01[Z Primitive](l *Linker, modName, funcName string, f func() Z) error
- func DefineFunc02[Y, Z Primitive](l *Linker, modName, funcName string, f func() (Y, Z)) error
- func DefineFunc10[A Primitive](l *Linker, modName, funcName string, f func(A)) error
- func DefineFunc11[A, Z Primitive](l *Linker, modName, funcName string, f func(A) Z) error
- func DefineFunc12[A, Y, Z Primitive](l *Linker, modName, funcName string, f func(A) (Y, Z)) error
- func DefineFunc20[A, B Primitive](l *Linker, modName, funcName string, f func(A, B)) error
- func DefineFunc21[A, B, Z Primitive](l *Linker, modName, funcName string, f func(A, B) Z) error
- func DefineFunc22[A, B, Y, Z Primitive](l *Linker, modName, funcName string, f func(A, B) (Y, Z)) error
- func DefineFunc31[A, B, C, Z Primitive](l *Linker, modName, funcName string, f func(A, B, C) Z) error
- func DefineFunc32[A, B, C, Y, Z Primitive](l *Linker, modName, funcName string, f func(A, B, C) (Y, Z)) error
- func DefineGlobal[T any](l *Linker, modName, globalName string, global T) error
- type Instance
- type Linker
- func (l *Linker) Define(modName string, mod *Module)
- func (l *Linker) DefineMemory(modName, memName string, mem []byte) error
- func (l *Linker) DefineRawHostFunc(modName, funcName string, f wasm.RawHostFunc, ins []any, outs []any) error
- func (l *Linker) DefineTable(modName, tableName string, table []*uint32) error
- func (l *Linker) Instantiate(mainModule *Module) (*Instance, error)
- type Module
- type Primitive
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrInvalidSign = errors.New("invalid signature")
)
errors on linking modules
Functions ¶
func DefineFunc ¶
func DefineFunc01 ¶
func DefineFunc02 ¶
func DefineFunc10 ¶
func DefineFunc11 ¶
func DefineFunc12 ¶
func DefineFunc20 ¶
func DefineFunc21 ¶
func DefineFunc22 ¶
func DefineFunc31 ¶
func DefineFunc32 ¶
Types ¶
type Linker ¶
type Linker struct { config.LinkerConfig Modules map[string]*Module // the built-in modules which acts as externs when instantiating coming main module }
Linker is a helper to instantiate new modules
func NewLinkerWithModuleMap ¶
func NewLinkerWithModuleMap(config config.LinkerConfig, in map[string]*Module) *Linker
NewLinkerWithModuleMap creates a new Linker with the built-in modules
func (*Linker) DefineMemory ¶
DefineMemory will defined an external memory for the main module
func (*Linker) DefineRawHostFunc ¶
func (l *Linker) DefineRawHostFunc( modName, funcName string, f wasm.RawHostFunc, ins []any, outs []any, ) error
DefineRawHostFunc puts a simple raw func into Linker's modules.
func (*Linker) DefineTable ¶
DefineTable will defined an external table for the main module
type Module ¶
Module is same to wasm.Module
func NewModuleFromBytes ¶
func NewModuleFromBytes(config config.ModuleConfig, b []byte) (*Module, error)
NewModuleFromBytes is a wrapper to the wasm.NewModule that avoids having to make a copy of bytes that are already in memory.
Click to show internal directories.
Click to hide internal directories.