12#if defined(__CMAKE_TARGET_TYPE__) && __CMAKE_TARGET_TYPE__ == 2
18#if defined(__CMAKE_TARGET_TYPE__) && __CMAKE_TARGET_TYPE__ == 2
22inline void __startup_catch_exception__(
const std::exception& e) {std::cerr << std::endl <<
xtd::ustring::format(
"Unhandled exception: {}",
e.what()) << std::endl;}
24inline void __startup_catch_exception__() { std::cerr << std::endl <<
xtd::ustring::format(
"Unhandled exception: Unknown exception occurred") << std::endl;}
49 #define startup_(main_class) \
50 int main(int argc, char* argv[]) {\
52 struct startup final static_ {\
53 static int run(void (*main_function)(), int, char*[]) {main_function(); return xtd::environment::exit_code();}\
54 static int run(int (*main_function)(), int, char*[]) {return main_function();}\
55 static int run(void (*main_function)(int argc, char* argv[]), int argc, char* argv[]) {main_function(argc, argv); return xtd::environment::exit_code();}\
56 static int run(void (*main_function)(xtd::collections::specialized::string_vector), int argc, char* argv[]) {main_function({argv + 1, argv + argc}); return xtd::environment::exit_code();}\
57 static int run(void (*main_function)(const xtd::collections::specialized::string_vector&), int argc, char* argv[]) {main_function({argv + 1, argv + argc}); return xtd::environment::exit_code();}\
58 static int run(int (*main_function)(int argc, char* argv[]), int argc, char* argv[]) {return main_function(argc, argv);}\
59 static int run(int (*main_function)(xtd::collections::specialized::string_vector), int argc, char* argv[]) {return main_function({argv + 1, argv + argc});}\
60 static int run(int (*main_function)(const xtd::collections::specialized::string_vector&), int argc, char* argv[]) {return main_function({argv + 1, argv + argc});}\
62 return startup::run(main_class::main, argc, argv);\
63 } catch(const xtd::system_exception& e) {\
64 __startup_catch_exception__(e);\
65 } catch(const std::exception& e) {\
66 __startup_catch_exception__(e);\
68 __startup_catch_exception__();\
71 int __startup_force_to_end_with_semicolon__ = 0
Contains xtd::forms::application class.
Defines the base class for predefined exceptions in the xtd namespace.
Definition system_exception.h:24
Contains xtd::console class.
Contains xtd::environment class.
Contains xtd::forms::exception_box dialog.
@ show
Display the hot-key prefix.
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition system_report.h:17
Contains xtd::static_object class.
Contains xtd::collections::specialized::string_vector typedef.
Contains xtd::system_exception exception.
Contains xtd::ustring class.