Defines the xtd::startup object that can be used in the main method to safely call the application's main entry point. 
- Namespace
 - xtd 
 
- Library
 - xtd.core 
 
 | 
| template<typename main_function_t >  | 
| static int  | safe_run (main_function_t main_function) | 
|   | Safely call the specified application's main entry point.  
  | 
|   | 
| template<typename main_function_t >  | 
| static int  | safe_run (main_function_t main_function, int argc, char *argv[]) | 
|   | Safely call the specified application's main entry point, argc and argv.  
  | 
|   | 
◆ safe_run() [1/2]
template<typename main_function_t > 
  
  
      
        
          | static int xtd::startup::safe_run  | 
          ( | 
          main_function_t  | 
          main_function | ) | 
           | 
         
       
   | 
  
inlinestatic   | 
  
 
Safely call the specified application's main entry point. 
- Parameters
 - 
  
    | main_function | The main method to safety call.  | 
  
   
- Parameters
 - 
  
    | main_class | The class that contains the static main method.  | 
  
   
- Examples
 - This example show a main_function without arguments and without return code 
#include <xtd/console>
#include <xtd/environment>
#include <xtd/startup>
 
 
namespace startup1_example {
  class program {
  public:
    static void main() {
      
        
      
      environment::exit_code(42);
    }
  };
}
 
auto main() -> int {
}
 
 
Represents the standard input, output, and error streams for console applications.
Definition console.hpp:36
 
The environment class.
Definition environment.hpp:67
 
static int safe_run(main_function_t main_function)
Safely call the specified application's main entry point.
Definition startup.hpp:47
 
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.hpp:10
 
   
- This example show a main_function with a return code and without arguments 
#include <xtd/console>
#include <xtd/environment>
#include <xtd/startup>
 
 
namespace startup2_example {
  class program {
  public:
    static int main() {
      
        
      return 42;
    }
  };
}
 
auto main() -> int {
}
 
 
   
- This example show a main_function with argument and without return code 
#include <xtd/console>
#include <xtd/environment>
#include <xtd/startup>
 
 
namespace startup3_example {
  class program {
  public:
      
      for (auto arg : args)
        
      
      environment::exit_code(42);
    }
  };
}
 
auto main() -> int {
}
 
 
Represents a strongly typed list of objects that can be accessed by index. Provides methods to search...
Definition list.hpp:71
 
   
- This example show a main_function with argument and return code 
#include <xtd/console>
#include <xtd/startup>
 
 
namespace startup4_example {
  class program {
  public:
      
      for (auto arg : args)
        
      return 42;
    }
  };
}
 
auto main() -> int {
}
 
 
   
- Examples
 - startup.cpp.
 
 
 
◆ safe_run() [2/2]
template<typename main_function_t > 
  
  
      
        
          | static int xtd::startup::safe_run  | 
          ( | 
          main_function_t  | 
          main_function,  | 
         
        
           | 
           | 
          int  | 
          argc,  | 
         
        
           | 
           | 
          char *  | 
          argv[]  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
inlinestatic   | 
  
 
Safely call the specified application's main entry point, argc and argv. 
- Parameters
 - 
  
    | main_function | The main method to safety call.  | 
    | argc | the main argc param.  | 
    | argv | the main argv param.  | 
  
   
- Parameters
 - 
  
    | main_class | The class that contains the static main method.  | 
  
   
- Examples
 - This example show a main_function without arguments and without return code 
#include <xtd/console>
#include <xtd/environment>
#include <xtd/startup>
 
 
namespace startup1_example {
  class program {
  public:
    static void main() {
      
        
      
      environment::exit_code(42);
    }
  };
}
 
auto main() -> int {
}
 
 
   
- This example show a main_function with a return code and without arguments 
#include <xtd/console>
#include <xtd/environment>
#include <xtd/startup>
 
 
namespace startup2_example {
  class program {
  public:
    static int main() {
      
        
      return 42;
    }
  };
}
 
auto main() -> int {
}
 
 
   
- This example show a main_function with argument and without return code 
#include <xtd/console>
#include <xtd/environment>
#include <xtd/startup>
 
 
namespace startup3_example {
  class program {
  public:
      
      for (auto arg : args)
        
      
      environment::exit_code(42);
    }
  };
}
 
auto main() -> int {
}
 
 
   
- This example show a main_function with argument and return code 
#include <xtd/console>
#include <xtd/startup>
 
 
namespace startup4_example {
  class program {
  public:
      
      for (auto arg : args)
        
      return 42;
    }
  };
}
 
auto main() -> int {
}
 
 
   
 
 
The documentation for this class was generated from the following file: