@@ -262,6 +262,7 @@ iwasm(int argc, char **argv)
262
262
wasm_module_t wasm_module = NULL ;
263
263
wasm_module_inst_t wasm_module_inst = NULL ;
264
264
RuntimeInitArgs init_args ;
265
+ struct InstantiationArgs2 * inst_args ;
265
266
static char error_buf [128 ] = { 0 };
266
267
/* avoid stack overflow */
267
268
#if WASM_ENABLE_LIBC_WASI != 0
@@ -369,13 +370,23 @@ iwasm(int argc, char **argv)
369
370
rt_kprintf ("%s\n" , error_buf );
370
371
goto fail2 ;
371
372
}
373
+
374
+ if (!wasm_runtime_instantiation_args_create (& inst_args )) {
375
+ printf ("failed to create instantiate args\n" );
376
+ goto fail3 ;
377
+ }
378
+ wasm_runtime_instantiation_args_set_default_stack_size (inst_args ,
379
+ stack_size );
380
+ wasm_runtime_instantiation_args_set_host_managed_heap_size (inst_args ,
381
+ heap_size );
372
382
#if WASM_ENABLE_LIBC_WASI != 0
373
383
libc_wasi_init (wasm_module , argc , argv , & wasi_parse_ctx );
374
384
#endif
375
385
376
386
rt_memset (error_buf , 0x00 , sizeof (error_buf ));
377
- wasm_module_inst = wasm_runtime_instantiate (
378
- wasm_module , stack_size , heap_size , error_buf , sizeof (error_buf ));
387
+ wasm_module_inst = wasm_runtime_instantiate_ex2 (
388
+ wasm_module , inst_args , error_buf , sizeof (error_buf ));
389
+ wasm_runtime_instantiation_args_destroy (inst_args );
379
390
if (!wasm_module_inst ) {
380
391
rt_kprintf ("%s\n" , error_buf );
381
392
goto fail3 ;
0 commit comments