mirror of
https://github.com/mii443/wasmer.git
synced 2025-12-08 05:38:19 +00:00
feat(cli) Update the crate_exe_main.c file to the latest Wasm C API.
This commit is contained in:
@@ -134,20 +134,22 @@ int main(int argc, char* argv[]) {
|
|||||||
|
|
||||||
wasm_importtype_vec_t import_types;
|
wasm_importtype_vec_t import_types;
|
||||||
wasm_module_imports(module, &import_types);
|
wasm_module_imports(module, &import_types);
|
||||||
int num_imports = import_types.size;
|
|
||||||
wasm_extern_t** imports = (wasm_extern_t**) malloc(num_imports * sizeof(wasm_extern_t*));
|
wasm_extern_vec_new_uninitialized(&imports, import_type.size);
|
||||||
wasm_importtype_vec_delete(&import_types);
|
wasm_importtype_vec_delete(&import_types);
|
||||||
|
|
||||||
#ifdef WASI
|
#ifdef WASI
|
||||||
bool get_imports_result = wasi_get_imports(store, module, wasi_env, imports);
|
bool get_imports_result = wasi_get_imports(store, module, wasi_env, &imports);
|
||||||
|
|
||||||
if (!get_imports_result) {
|
if (!get_imports_result) {
|
||||||
fprintf(stderr, "Error getting WASI imports!\n");
|
fprintf(stderr, "Error getting WASI imports!\n");
|
||||||
print_wasmer_error();
|
print_wasmer_error();
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
wasm_instance_t* instance = wasm_instance_new(store, module, (const wasm_extern_t* const*) imports, NULL);
|
wasm_instance_t* instance = wasm_instance_new(store, module, &imports, NULL);
|
||||||
if (! instance) {
|
if (! instance) {
|
||||||
fprintf(stderr, "Failed to create instance\n");
|
fprintf(stderr, "Failed to create instance\n");
|
||||||
print_wasmer_error();
|
print_wasmer_error();
|
||||||
|
|||||||
Reference in New Issue
Block a user