MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime-go / DefineInstance

Method DefineInstance

linker.go:156–172  ·  view source on GitHub ↗

DefineInstance defines all exports of an instance provided under the module name provided. Returns an error if shadowing is disabled and names are already defined.

(store Storelike, module string, instance *Instance)

Source from the content-addressed store, hash-verified

154//
155// Returns an error if shadowing is disabled and names are already defined.
156func (l *Linker) DefineInstance(store Storelike, module string, instance *Instance) error {
157 err := C.wasmtime_linker_define_instance(
158 l.ptr(),
159 store.Context(),
160 C._GoStringPtr(module),
161 C._GoStringLen(module),
162 &instance.val,
163 )
164 runtime.KeepAlive(l)
165 runtime.KeepAlive(module)
166 runtime.KeepAlive(store)
167 if err == nil {
168 return nil
169 }
170
171 return mkError(err)
172}
173
174// DefineModule defines automatic instantiations of the module in this linker.
175//

Callers 2

TestLinkerFunction · 0.95
ExampleLinkerFunction · 0.95

Calls 3

ptrMethod · 0.95
mkErrorFunction · 0.85
ContextMethod · 0.65

Tested by 2

TestLinkerFunction · 0.76
ExampleLinkerFunction · 0.76