#include "mono/utils/mono-counters.h"
#include "mono/utils/mono-hwcap.h"
#include "mono/utils/mono-logger-internals.h"
+#include "mono/utils/w32handle.h"
#include "mini.h"
#include "jit.h"
if (exc) {
mono_unhandled_exception (exc);
mono_invoke_unhandled_exception_hook (exc);
- return 1;
+ g_assert_not_reached ();
}
return res;
} else {
int res = mono_runtime_run_main_checked (method, argc, argv, &error);
- mono_error_raise_exception (&error); /* OK, triggers unhandled exn handler */
+ if (!is_ok (&error)) {
+ MonoException *ex = mono_error_convert_to_exception (&error);
+ if (ex) {
+ mono_unhandled_exception (&ex->object);
+ mono_invoke_unhandled_exception_hook (&ex->object);
+ g_assert_not_reached ();
+ }
+ }
return res;
}
}
#define error_if_aot_unsupported()
#endif
-#ifdef HOST_WIN32
-BOOL APIENTRY DllMain (HMODULE module_handle, DWORD reason, LPVOID reserved)
-{
- if (!mono_gc_dllmain (module_handle, reason, reserved))
- return FALSE;
-
- switch (reason)
- {
- case DLL_PROCESS_ATTACH:
- mono_install_runtime_load (mini_init);
- break;
- case DLL_PROCESS_DETACH:
- if (coree_module_handle)
- FreeLibrary (coree_module_handle);
- break;
- case DLL_THREAD_DETACH:
- mono_thread_info_detach ();
- break;
-
- }
- return TRUE;
-}
-#endif
-
static gboolean enable_debugging;
/*
if (!mono_debugger_insert_breakpoint (argv [++i], FALSE))
fprintf (stderr, "Error: invalid method name '%s'\n", argv [i]);
+ } else if (strncmp (argv[i], "--gc-params=", 12) == 0) {
+ mono_gc_params_set (argv[i] + 12);
+ } else if (strncmp (argv[i], "--gc-debug=", 11) == 0) {
+ mono_gc_debug_set (argv[i] + 11);
} else if (strcmp (argv [i], "--llvm") == 0) {
#ifndef MONO_ARCH_LLVM_SUPPORTED
fprintf (stderr, "Mono Warning: --llvm not supported on this platform.\n");
#ifdef HAVE_EXECVP
execvp (path->str, argv);
+ fprintf (stderr, "Error: Failed to switch to %s gc. mono-%s is not installed.\n", target_gc, target_gc);
#else
fprintf (stderr, "Error: --gc=<NAME> option not supported on this platform.\n");
#endif
switch_gc (argv, "sgen");
} else if (strcmp (argv [i], "--gc=boehm") == 0) {
switch_gc (argv, "boehm");
+ } else if (strncmp (argv[i], "--gc-params=", 12) == 0) {
+ mono_gc_params_set (argv[i] + 12);
+ } else if (strncmp (argv[i], "--gc-debug=", 11) == 0) {
+ mono_gc_debug_set (argv[i] + 11);
}
#ifdef TARGET_OSX
else if (strcmp (argv [i], "--arch=32") == 0) {
} else if (strcmp (argv [i], "--llvmonly") == 0) {
mono_aot_only = TRUE;
mono_llvm_only = TRUE;
+ } else if (strcmp (argv [i], "--hybrid-aot") == 0) {
} else if (strcmp (argv [i], "--print-vtable") == 0) {
mono_print_vtable = TRUE;
} else if (strcmp (argv [i], "--stats") == 0) {
mono_counters_init ();
+#ifndef HOST_WIN32
+ mono_w32handle_init ();
+#endif
+
/* Set rootdir before loading config */
mono_set_rootdir ();
exit (1);
}
-#ifdef HOST_WIN32
+#if defined(HOST_WIN32) && G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
/* Detach console when executing IMAGE_SUBSYSTEM_WINDOWS_GUI on win32 */
if (!enable_debugging && !mono_compile_aot && ((MonoCLIImageInfo*)(mono_assembly_get_image (assembly)->image_info))->cli_header.nt.pe_subsys_required == IMAGE_SUBSYSTEM_WINDOWS_GUI)
FreeConsole ();