[mini] Use C++ linker iff building C++ that needs the C++ runtime (#12266)
[mono-project.git] / mono / metadata / exception.h
blobd05a0b239d85fd182f708f54b2d06b4b13b6e3cc
1 /**
2 * \file
3 */
5 #ifndef _MONO_METADATA_EXCEPTION_H_
6 #define _MONO_METADATA_EXCEPTION_H_
8 #include <mono/metadata/object-forward.h>
9 #include <mono/metadata/object.h>
10 #include <mono/metadata/image.h>
12 MONO_BEGIN_DECLS
14 MONO_API MonoException *
15 mono_exception_from_name (MonoImage *image,
16 const char* name_space,
17 const char *name);
19 MONO_API MonoException *
20 mono_exception_from_token (MonoImage *image, uint32_t token);
22 MONO_API MONO_RT_EXTERNAL_ONLY
23 MonoException *
24 mono_exception_from_name_two_strings (MonoImage *image, const char *name_space,
25 const char *name, MonoString *a1, MonoString *a2);
27 MONO_API MonoException *
28 mono_exception_from_name_msg (MonoImage *image, const char *name_space,
29 const char *name, const char *msg);
31 MONO_API MONO_RT_EXTERNAL_ONLY
32 MonoException *
33 mono_exception_from_token_two_strings (MonoImage *image, uint32_t token,
34 MonoString *a1, MonoString *a2);
36 MONO_API MonoException *
37 mono_exception_from_name_domain (MonoDomain *domain, MonoImage *image,
38 const char* name_space,
39 const char *name);
41 MONO_API MonoException *
42 mono_get_exception_divide_by_zero (void);
44 MONO_API MonoException *
45 mono_get_exception_security (void);
47 MONO_API MonoException *
48 mono_get_exception_arithmetic (void);
50 MONO_API MonoException *
51 mono_get_exception_overflow (void);
53 MONO_API MonoException *
54 mono_get_exception_null_reference (void);
56 MONO_API MonoException *
57 mono_get_exception_execution_engine (const char *msg);
59 MONO_API MonoException *
60 mono_get_exception_thread_abort (void);
62 MONO_API MONO_RT_EXTERNAL_ONLY
63 MonoException *
64 mono_get_exception_thread_state (const char *msg);
66 MONO_API MONO_RT_EXTERNAL_ONLY
67 MonoException *
68 mono_get_exception_thread_interrupted (void);
70 MONO_API MonoException *
71 mono_get_exception_serialization (const char *msg);
73 MONO_API MonoException *
74 mono_get_exception_invalid_cast (void);
76 MONO_API MonoException *
77 mono_get_exception_invalid_operation (const char *msg);
79 MONO_API MonoException *
80 mono_get_exception_index_out_of_range (void);
82 MONO_API MonoException *
83 mono_get_exception_array_type_mismatch (void);
85 MONO_API MonoException *
86 mono_get_exception_type_load (MonoString *class_name, char *assembly_name);
88 MONO_API MONO_RT_EXTERNAL_ONLY
89 MonoException *
90 mono_get_exception_missing_method (const char *class_name, const char *member_name);
92 MONO_API MONO_RT_EXTERNAL_ONLY
93 MonoException *
94 mono_get_exception_missing_field (const char *class_name, const char *member_name);
96 MONO_API MONO_RT_EXTERNAL_ONLY
97 MonoException *
98 mono_get_exception_not_implemented (const char *msg);
100 MONO_API MonoException *
101 mono_get_exception_not_supported (const char *msg);
103 MONO_API MonoException*
104 mono_get_exception_argument_null (const char *arg);
106 MONO_API MonoException *
107 mono_get_exception_argument (const char *arg, const char *msg);
109 MONO_API MONO_RT_EXTERNAL_ONLY
110 MonoException *
111 mono_get_exception_argument_out_of_range (const char *arg);
113 MONO_API MONO_RT_EXTERNAL_ONLY
114 MonoException *
115 mono_get_exception_io (const char *msg);
117 MONO_API MONO_RT_EXTERNAL_ONLY
118 MonoException *
119 mono_get_exception_file_not_found (MonoString *fname);
121 MONO_API MONO_RT_EXTERNAL_ONLY
122 MonoException *
123 mono_get_exception_file_not_found2 (const char *msg, MonoString *fname);
125 MONO_API MONO_RT_EXTERNAL_ONLY
126 MonoException *
127 mono_get_exception_type_initialization (const char *type_name, MonoException *inner);
129 MONO_API MONO_RT_EXTERNAL_ONLY
130 MonoException *
131 mono_get_exception_synchronization_lock (const char *msg);
133 MONO_API MonoException *
134 mono_get_exception_cannot_unload_appdomain (const char *msg);
136 MONO_API MonoException *
137 mono_get_exception_appdomain_unloaded (void);
139 MONO_API MonoException *
140 mono_get_exception_bad_image_format (const char *msg);
142 MONO_API MONO_RT_EXTERNAL_ONLY
143 MonoException *
144 mono_get_exception_bad_image_format2 (const char *msg, MonoString *fname);
146 MONO_API MonoException *
147 mono_get_exception_stack_overflow (void);
149 MONO_API MONO_RT_EXTERNAL_ONLY
150 MonoException *
151 mono_get_exception_out_of_memory (void);
153 MONO_API MONO_RT_EXTERNAL_ONLY
154 MonoException *
155 mono_get_exception_field_access (void);
157 MONO_API MonoException *
158 mono_get_exception_method_access (void);
160 MONO_API MONO_RT_EXTERNAL_ONLY
161 MonoException *
162 mono_get_exception_reflection_type_load (MonoArray *types, MonoArray *exceptions);
164 MONO_API MONO_RT_EXTERNAL_ONLY
165 MonoException *
166 mono_get_exception_runtime_wrapped (MonoObject *wrapped_exception);
168 /* Installs a function which is called when the runtime encounters an unhandled exception.
169 * This hook isn't expected to return.
170 * If no hook has been installed, the runtime will print a message before aborting.
172 typedef void (*MonoUnhandledExceptionFunc) (MonoObject *exc, void *user_data);
173 MONO_API void mono_install_unhandled_exception_hook (MonoUnhandledExceptionFunc func, void *user_data);
174 void mono_invoke_unhandled_exception_hook (MonoObject *exc);
176 MONO_END_DECLS
178 #endif /* _MONO_METADATA_EXCEPTION_H_ */