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

Method GetDefault

linker.go:263–280  ·  view source on GitHub ↗

GetDefault acquires the "default export" of the named module in this linker. If there is no default item then an error is returned, otherwise the default function is returned. For more information see the Rust documentation -- https://docs.wasmtime.dev/api/wasmtime/struct.Linker.html#method.get_de

(store Storelike, name string)

Source from the content-addressed store, hash-verified

261// For more information see the Rust documentation --
262// https://docs.wasmtime.dev/api/wasmtime/struct.Linker.html#method.get_default.
263func (l *Linker) GetDefault(store Storelike, name string) (*Func, error) {
264 var ret C.wasmtime_func_t
265 err := C.wasmtime_linker_get_default(
266 l.ptr(),
267 store.Context(),
268 C._GoStringPtr(name),
269 C._GoStringLen(name),
270 &ret,
271 )
272 runtime.KeepAlive(l)
273 runtime.KeepAlive(name)
274 runtime.KeepAlive(store)
275 if err != nil {
276 return nil, mkError(err)
277 }
278 return mkFunc(ret), nil
279
280}
281
282// GetOneByName loads an item by name from this linker.
283//

Callers 1

TestLinkerGetDefaultFunction · 0.95

Calls 4

ptrMethod · 0.95
mkErrorFunction · 0.85
mkFuncFunction · 0.85
ContextMethod · 0.65

Tested by 1

TestLinkerGetDefaultFunction · 0.76