ModuleValidate validates whether `wasm` would be a valid wasm module according to the configuration in `store`
(engine *Engine, wasm []byte)
| 35 | // ModuleValidate validates whether `wasm` would be a valid wasm module according to the |
| 36 | // configuration in `store` |
| 37 | func ModuleValidate(engine *Engine, wasm []byte) error { |
| 38 | var wasmPtr *C.uint8_t |
| 39 | if len(wasm) > 0 { |
| 40 | wasmPtr = (*C.uint8_t)(unsafe.Pointer(&wasm[0])) |
| 41 | } |
| 42 | err := C.wasmtime_module_validate(engine.ptr(), wasmPtr, C.size_t(len(wasm))) |
| 43 | runtime.KeepAlive(engine) |
| 44 | runtime.KeepAlive(wasm) |
| 45 | if err == nil { |
| 46 | return nil |
| 47 | } |
| 48 | |
| 49 | return mkError(err) |
| 50 | } |
| 51 | |
| 52 | // Serialize will convert this in-memory compiled module into a list of bytes. |
| 53 | // |
searching dependent graphs…