Add bad string resistent utf16-utf8 conversions.
[mono.git] / mono / metadata / runtime.c
1 /*
2  * runtime.c: Runtime functions
3  *
4  * Authors:
5  *  Jonathan Pryor 
6  *
7  * Copyright 2010 Novell, Inc (http://www.novell.com)
8  */
9
10 #include <config.h>
11
12 #include <glib.h>
13
14 #include <mono/metadata/appdomain.h>
15 #include <mono/metadata/class.h>
16 #include <mono/metadata/class-internals.h>
17 #include <mono/metadata/runtime.h>
18
19 static void
20 fire_process_exit_event (MonoDomain *domain, gpointer user_data)
21 {
22         MonoClassField *field;
23         gpointer pa [2];
24         MonoObject *delegate, *exc;
25
26         field = mono_class_get_field_from_name (mono_defaults.appdomain_class, "ProcessExit");
27         g_assert (field);
28
29         delegate = *(MonoObject **)(((char *)domain->domain) + field->offset); 
30         if (delegate == NULL)
31                 return;
32
33         pa [0] = domain;
34         pa [1] = NULL;
35         mono_runtime_delegate_invoke (delegate, pa, &exc);
36 }
37
38 void
39 mono_runtime_shutdown (void)
40 {
41         mono_domain_foreach (fire_process_exit_event, NULL);
42 }
43