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

Method Exports

instance.go:66–87  ·  view source on GitHub ↗

Exports returns a list of exports from this instance. Each export is returned as a `*Extern` and lines up with the exports list of the associated `Module`.

(store Storelike)

Source from the content-addressed store, hash-verified

64// Each export is returned as a `*Extern` and lines up with the exports list of
65// the associated `Module`.
66func (instance *Instance) Exports(store Storelike) []*Extern {
67 ret := make([]*Extern, 0)
68 var name *C.char
69 var name_len C.size_t
70 for i := 0; ; i++ {
71 var item C.wasmtime_extern_t
72 ok := C.wasmtime_instance_export_nth(
73 store.Context(),
74 &instance.val,
75 C.size_t(i),
76 &name,
77 &name_len,
78 &item,
79 )
80 if !ok {
81 break
82 }
83 ret = append(ret, mkExtern(&item))
84 }
85 runtime.KeepAlive(store)
86 return ret
87}
88
89// GetExport attempts to find an export on this instance by `name`
90//

Callers 2

TestInstanceFunction · 0.95
TestLinkerFunction · 0.95

Calls 2

mkExternFunction · 0.85
ContextMethod · 0.65

Tested by 2

TestInstanceFunction · 0.76
TestLinkerFunction · 0.76