File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -730,6 +730,26 @@ impl<'a> NotStartedModuleRef<'a> {
730730 Ok ( self . instance )
731731 }
732732
733+ /// Executes `start` function (if any) and returns fully instantiated module.
734+ ///
735+ /// # Errors
736+ ///
737+ /// Returns `Err` if start function traps.
738+ pub fn run_start_with_stack < E : Externals > (
739+ self ,
740+ state : & mut E ,
741+ stack_recycler : & mut StackRecycler ,
742+ ) -> Result < ModuleRef , Trap > {
743+ if let Some ( start_fn_idx) = self . loaded_module . module ( ) . start_section ( ) {
744+ let start_func = self
745+ . instance
746+ . func_by_index ( start_fn_idx)
747+ . expect ( "Due to validation start function should exists" ) ;
748+ FuncInstance :: invoke_with_stack ( & start_func, & [ ] , state, stack_recycler) ?;
749+ }
750+ Ok ( self . instance )
751+ }
752+
733753 /// Returns fully instantiated module without running `start` function.
734754 ///
735755 /// # Panics
You can’t perform that action at this time.
0 commit comments