|
66 | 66 | uint8 *file_buf = NULL; |
67 | 67 | uint32 file_buf_size = 0; |
68 | 68 | wasm_module_t module = NULL; |
| 69 | + wasm_module_t module1; |
69 | 70 | wasm_module_inst_t module_inst = NULL; |
70 | 71 |
|
71 | 72 | /* all malloc() only from the given buffer */ |
@@ -122,6 +123,33 @@ main() |
122 | 123 | "call \"C5\", it will be failed since it is a export function, ===> "); |
123 | 124 | wasm_application_execute_func(module_inst, "C5", 0, args); |
124 | 125 |
|
| 126 | + /* examine module registration a bit */ |
| 127 | + module1 = wasm_runtime_find_module_registered("mC"); |
| 128 | + if (module1 != NULL) { |
| 129 | + printf("unexpected module mC %p != NULL\n", module1); |
| 130 | + goto UNLOAD_MODULE; |
| 131 | + } |
| 132 | + module1 = wasm_runtime_find_module_registered("mA"); |
| 133 | + if (module1 == NULL) { |
| 134 | + printf("unexpected module mA\n"); |
| 135 | + goto UNLOAD_MODULE; |
| 136 | + } |
| 137 | + module1 = wasm_runtime_find_module_registered("mB"); |
| 138 | + if (module1 == NULL) { |
| 139 | + printf("unexpected module mB\n"); |
| 140 | + goto UNLOAD_MODULE; |
| 141 | + } |
| 142 | + if (!wasm_runtime_register_module("mC", module, error_buf, |
| 143 | + sizeof(error_buf))) { |
| 144 | + printf("%s\n", error_buf); |
| 145 | + goto UNLOAD_MODULE; |
| 146 | + } |
| 147 | + module1 = wasm_runtime_find_module_registered("mC"); |
| 148 | + if (module1 != module) { |
| 149 | + printf("unexpected module mC %p != %p\n", module1, module); |
| 150 | + goto UNLOAD_MODULE; |
| 151 | + } |
| 152 | + |
125 | 153 | ret = true; |
126 | 154 |
|
127 | 155 | printf("- wasm_runtime_deinstantiate\n"); |
|
0 commit comments