11#define __XTD_CORE_INTERNAL__
13#undef __XTD_CORE_INTERNAL__
46 template <
typename main_function_t>
47 static int safe_run(main_function_t main_function) {
48 return internal_safe_run(main_function, std::nullopt, std::nullopt);
71 template <
typename main_function_t>
72 static int safe_run(main_function_t main_function,
int argc,
char* argv[]) {
73 return internal_safe_run(main_function, argc, argv);
78 static int safe_run(xtd::delegate<
void()> main_function,
int argc,
char* argv[]);
79 static int safe_run(xtd::delegate<
void()> main_function);
80 static int safe_run(xtd::delegate<
void(
int,
char* [])> main_function,
int argc,
char* argv[]);
81 static int safe_run(xtd::delegate<
void(
int,
char* [])> main_function);
84 static int safe_run(xtd::delegate<
int()> main_function,
int argc,
char* argv[]);
85 static int safe_run(xtd::delegate<
int()> main_function);
86 static int safe_run(xtd::delegate<
int(
int,
char* [])> main_function,
int argc,
char* argv[]);
87 static int safe_run(xtd::delegate<
int(
int,
char* [])> main_function);
90 static int safe_run(
void (*main_function)(
int,
char* []),
int argc,
char* argv[]);
91 static int safe_run(
void (*main_function)(
int,
char* []));
94 static int safe_run(
int (*main_function)(
int,
char* []),
int argc,
char* argv[]);
95 static int safe_run(
int (*main_function)(
int,
char* []));
101 template <
typename main_function_t>
102 static int internal_safe_run(main_function_t main_function, std::optional<int> argc, std::optional<char**> argv) {
105 auto exit_code = argc == std::nullopt && argv == std::nullopt ? run(main_function) : run(main_function, argc.value(), argv.value());
108 }
catch(
const std::exception& e) {
109 __show_generic_exception_message__(e);
112 __show_generic_exception_message__();
117 static void init_safe_run();
119 static void end_safe_run();
121 static int run(xtd::delegate<
void()> main_function,
int argc,
char* argv[]);
122 static int run(xtd::delegate<
void()> main_function);
123 static int run(
void (*main_function)(),
int argc,
char* argv[]);
124 static int run(
void (*main_function)());
125 static int run(xtd::delegate<
void(
int,
char* [])> main_function,
int argc,
char* argv[]);
126 static int run(xtd::delegate<
void(
int,
char* [])> main_function);
127 static int run(
void (*main_function)(
int,
char* []),
int argc,
char* argv[]);
128 static int run(
void (*main_function)(
int,
char* []));
133 static int run(xtd::delegate<
void(
const std::vector<string>&)> main_function,
int argc,
char* argv[]);
134 static int run(xtd::delegate<
void(
const std::vector<string>&)> main_function);
135 static int run(
void (*main_function)(
const std::vector<string>&),
int argc,
char* argv[]);
136 static int run(
void (*main_function)(
const std::vector<string>&));
137 static int run(xtd::delegate<
int()> main_function,
int argc,
char* argv[]);
138 static int run(xtd::delegate<
int()> main_function);
139 static int run(
int (*main_function)(),
int argc,
char* argv[]);
140 static int run(
int (*main_function)());
141 static int run(xtd::delegate<
int(
int,
char* [])> main_function,
int argc,
char* argv[]);
142 static int run(xtd::delegate<
int(
int,
char* [])> main_function);
143 static int run(
int (*main_function)(
int,
char* []),
int argc,
char* argv[]);
144 static int run(
int (*main_function)(
int,
char* []));
149 static int run(xtd::delegate<
int(
const std::vector<string>&)> main_function,
int argc,
char* argv[]);
150 static int run(xtd::delegate<
int(
const std::vector<string>&)> main_function);
151 static int run(
int (*main_function)(
const std::vector<string>&),
int argc,
char* argv[]);
152 static int run(
int (*main_function)(
const std::vector<string>&));
175#define startup_(main_method) \
176 auto main(int argc, char* argv[]) -> int { \
177 return xtd::startup::safe_run(main_method, argc, argv); \
179 intptr_t __opaque_sftews__ = 0
188#define startup_class_(main_class) \
189 auto main(int argc, char* argv[]) -> int { \
190 return xtd::startup::safe_run(main_class::main, argc, argv); \
192 intptr_t __opaque_sftews__ = 0
Contains show_generic_exception_message methods.
Contains xtd::argument_collection alias.
Represents a strongly typed list of objects that can be accessed by index. Provides methods to search...
Definition list.hpp:71
Defines the xtd::startup object that can be used in the main method to safely call the application's ...
Definition startup.hpp:23
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.
Definition startup.hpp:72
static int safe_run(main_function_t main_function)
Safely call the specified application's main entry point.
Definition startup.hpp:47
Contains core_export_ keyword.
Contains xtd::delegate delegate.
#define static_
This keyword is use to represent a static object. A static object can't be instantiated (constructors...
Definition static.hpp:37
#define core_export_
Define shared library export.
Definition core_export.hpp:13
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.hpp:10
Contains xtd::optional type.
Contains xtd::static_object class.