xtd 0.2.0
Loading...
Searching...
No Matches

◆ startup_

#define startup_ (   main_method)

#include <xtd.core/include/xtd/startup.h>

Defines the entry point to be called when the application loads. Generally this is set either to the main form in your application or to the main procedure that should run when the application starts.

Namespace
xtd
Library
xtd.core
Parameters
main_methodThe main method.
Examples
This example show a main method without arguments and without return code
#include <xtd/console>
#include <xtd/environment>
#include <xtd/startup>
using namespace xtd;
namespace main1_example {
class program {
public:
static void main() {
// Write arguments to the console output
for (auto arg : environment::get_command_line_args())
console::write_line(arg);
// return 42
environment::exit_code(42);
}
};
}
startup_(main1_example::program::main);
// Is the same as :
//
// auto main() -> int {
// return startup::safe_run(main1_example::program::main);
// }
// This code produces the following output if one two "three four" five are entered on command line:
//
// /!---OMITTED---!/main1
// one
// two
// three four
// five
Represents the standard input, output, and error streams for console applications.
Definition console.h:36
The environment class.
Definition environment.h:66
#define startup_(main_method)
Defines the entry point to be called when the application loads. Generally this is set either to the ...
Definition startup.h:175
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10
This example show a main method with a return code and without arguments
#include <xtd/console>
#include <xtd/environment>
#include <xtd/startup>
using namespace xtd;
namespace main2_example {
class program {
public:
static int main() {
// Write arguments to the console output
for (auto arg : environment::get_command_line_args())
console::write_line(arg);
return 42;
}
};
}
startup_(main2_example::program::main);
// Is the same as :
//
// auto main() -> int {
// return startup::safe_run(main2_example::program::main);
// }
// This code produces the following output if one two "three four" five are entered on command line:
//
// /!---OMITTED---!/main2
// one
// two
// three four
// five
This example show a main method with argument and without return code
#include <xtd/console>
#include <xtd/environment>
#include <xtd/startup>
using namespace xtd;
namespace main3_example {
class program {
public:
static void main(const string_collection& args) {
// Write arguments to the console output
for (auto arg : args)
console::write_line(arg);
// return 42
environment::exit_code(42);
}
};
}
startup_(main3_example::program::main);
// Is the same as :
//
// auto main() -> int {
// return startup::safe_run(main3_example::program::main);
// }
// This code produces the following output if one two "three four" five are entered on command line:
//
// one
// two
// three four
// five
Represents a strongly typed list of objects that can be accessed by index. Provides methods to search...
Definition list.h:72
The xtd::collections::specialized namespace contains specialized and strongly-typed collections; for ...
Definition string_collection.h:13
This example show a main method with argument and return code
#include <xtd/console>
#include <xtd/environment>
#include <xtd/startup>
using namespace xtd;
namespace main4_example {
class program {
public:
static int main(const string_collection& args) {
// Write arguments to the console output
for (auto arg : args)
console::write_line(arg);
return 42;
}
};
}
startup_(main4_example::program::main);
// Is the same as :
//
// auto main() -> int {
// return startup::safe_run(main4_example::program::main);
// }
// This code produces the following output if one two "three four" five are entered on command line:
//
// one
// two
// three four
// five
Examples
application_and_assert.cpp, application_and_exception.cpp, application_enable_dark_mode.cpp, application_enable_light_mode.cpp, application_with_cmake_assembly_info.cpp, application_with_manual_assembly_info.cpp, auto_reset_event.cpp, background_worker.cpp, barrier.cpp, barrier_simple.cpp, binary_reader.cpp, binary_reader2.cpp, binary_reader3.cpp, bit_converter_endianness.cpp, bit_converter_is_big_endian.cpp, bit_converter_is_little_endian.cpp, bit_converter_round_trips.cpp, border_style.cpp, calculator.cpp, change_parent.cpp, circular_form.cpp, console_clear.cpp, console_firework.cpp, countdown_event.cpp, countries.cpp, date_time.cpp, date_time_add.cpp, date_time_add_days.cpp, date_time_add_hours.cpp, date_time_add_milliseconds.cpp, date_time_add_minutes.cpp, date_time_add_months.cpp, date_time_add_seconds.cpp, date_time_add_years.cpp, date_time_date.cpp, date_time_day_of_week.cpp, date_time_day_of_year.cpp, date_time_days_in_month.cpp, date_time_days_in_month2.cpp, date_time_max_value.cpp, date_time_min_value.cpp, date_time_now.cpp, date_time_now2.cpp, date_time_specify_kind.cpp, date_time_sprintf.cpp, date_time_subtract.cpp, date_time_ticks.cpp, date_time_ticks2.cpp, date_time_time_of_day.cpp, date_time_to_string_format.cpp, date_time_today.cpp, debug_message_box.cpp, default_trace_listener.cpp, drive_info.cpp, environment_cancel_signal.cpp, environment_exit.cpp, environment_exit_code.cpp, environment_program_exit.cpp, event_wait_handle.cpp, file_info.cpp, file_info_append_text.cpp, file_info_move_to.cpp, file_info_open.cpp, file_info_open_read.cpp, file_info_open_text.cpp, file_info_open_write.cpp, file_info_replace.cpp, form_and_main.cpp, form_background_image.cpp, form_show.cpp, graph_control.cpp, horizontal_layout_panel.cpp, interlocked.cpp, interlocked_decrement.cpp, ip_address.cpp, lcd_label3.cpp, lock.cpp, lock_guard.cpp, lock_guard_keyword.cpp, main.cpp, main1.cpp, main2.cpp, main3.cpp, main4.cpp, manual_reset_event.cpp, math.cpp, mixing_std_and_xtd_threads.cpp, monitor.cpp, monitor_lock.cpp, monitor_pulse.cpp, monitor_pulse_all.cpp, mutex.cpp, semaphore.cpp, send_message_to_form.cpp, some_controls.cpp, some_system_controls.cpp, stack_trace.cpp, system_sound.cpp, system_sounds.cpp, target_default_namespace.cpp, test_console.cpp, test_forms.cpp, themes.cpp, thread.cpp, thread_pool.cpp, time_span.cpp, timeout.cpp, timer.cpp, timers_timer.cpp, timers_timer_synchronizing_object.cpp, trace_message_box.cpp, track_bar2.cpp, tutorial_application_icon.cpp, tutorial_button.cpp, tutorial_communicate.cpp, tutorial_simple_application.cpp, uri.cpp, version.cpp, version_os.cpp, vertical_layout_panel.cpp, and wait_handle.cpp.