Merge pull request #505 from roji/shutdown_flow
[mono.git] / mono / metadata / icall.c
index 1be47527f85a564707224dea6249fee79cf892c6..ed34f324fc96e03b17aa06a093c71102e58b846a 100644 (file)
@@ -73,6 +73,7 @@
 #include <mono/metadata/mono-debug.h>
 #include <mono/metadata/mono-ptr-array.h>
 #include <mono/metadata/verify-internals.h>
+#include <mono/metadata/runtime.h>
 #include <mono/io-layer/io-layer.h>
 #include <mono/utils/strtod.h>
 #include <mono/utils/monobitset.h>
@@ -6529,6 +6530,10 @@ ves_icall_System_Environment_Exit (int result)
 {
        MONO_ARCH_SAVE_REGS;
 
+#ifndef MONO_CROSS_COMPILE
+       mono_runtime_shutdown ();
+#endif
+
        mono_threads_set_shutting_down ();
 
        mono_runtime_set_shutting_down ();