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)
| 154 | // |
| 155 | // Returns an error if shadowing is disabled and names are already defined. |
| 156 | func (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 | // |