2 * appdomain.h: AppDomain functions
5 * Dietmar Maurer (dietmar@ximian.com)
7 * (C) 2001 Ximian, Inc.
10 #ifndef _MONO_METADATA_APPDOMAIN_H_
11 #define _MONO_METADATA_APPDOMAIN_H_
15 #include <mono/metadata/object.h>
16 #include <mono/metadata/reflection.h>
17 #include <mono/metadata/mempool.h>
18 #include <mono/utils/mono-hash.h>
19 #include <mono/io-layer/io-layer.h>
21 typedef void (*MonoThreadStartCB) (guint32 tid, gpointer stack_start,
23 typedef void (*MonoThreadAttachCB) (guint32 tid, gpointer stack_start);
25 /* This is a copy of System.AppDomainSetup */
28 MonoString *application_base;
29 MonoString *application_name;
30 MonoString *cache_path;
31 MonoString *configuration_file;
32 MonoString *dynamic_base;
33 MonoString *license_file;
34 MonoString *private_bin_path;
35 MonoString *private_bin_path_probe;
36 MonoString *shadow_copy_directories;
37 MonoString *shadow_copy_files;
38 MonoBoolean publisher_policy;
39 MonoBoolean path_changed;
42 typedef GArray MonoJitInfoTable;
48 gpointer handler_start;
53 } MonoJitExceptionInfo;
62 MonoJitExceptionInfo *clauses;
71 extern CRITICAL_SECTION *metadata_section;
73 typedef struct _MonoAppDomain MonoAppDomain;
76 MonoAppDomain *domain;
77 CRITICAL_SECTION lock;
81 GHashTable *assemblies;
82 MonoAssembly *entry_assembly;
83 MonoAppDomainSetup *setup;
85 MonoGHashTable *ldstr_table;
86 MonoGHashTable *class_vtable_hash;
87 MonoGHashTable *proxy_vtable_hash;
88 MonoGHashTable *static_data_hash;
89 GHashTable *jit_code_hash;
90 MonoJitInfoTable *jit_info_table;
91 /* hashtables for Reflection handles */
92 MonoGHashTable *type_hash;
93 MonoGHashTable *refobject_hash;
94 /* Needed by Thread:GetDomainID() */
96 /* Used when loading assemblies */
98 /* Used by remoting proxies */
99 MonoMethod *create_proxy_for_type_method;
100 MonoMethod *private_invoke_method;
101 MonoAppContext *default_context;
102 GHashTable *thread_static_fields;
103 GHashTable *jump_target_hash;
106 /* This is a copy of System.AppDomain */
107 struct _MonoAppDomain {
108 MonoMarshalByRefObject mbr;
112 extern MonoDomain *mono_root_domain;
114 extern HANDLE mono_delegate_semaphore;
115 extern CRITICAL_SECTION mono_delegate_section;
117 #define mono_domain_lock(domain) EnterCriticalSection(&(domain)->lock)
118 #define mono_domain_unlock(domain) LeaveCriticalSection(&(domain)->lock)
120 typedef void (*MonoDomainFunc) (MonoDomain *domain, gpointer user_data);
123 mono_init (const char *filename);
126 mono_runtime_init (MonoDomain *domain, MonoThreadStartCB start_cb,
127 MonoThreadAttachCB attach_cb);
130 mono_runtime_cleanup (MonoDomain *domain);
133 mono_runtime_install_cleanup (MonoDomainFunc func);
136 mono_runtime_quit (void);
139 mono_domain_create (void);
142 mono_domain_get (void);
145 mono_domain_get_by_id (gint32 domainid);
148 mono_domain_set (MonoDomain *domain);
151 mono_domain_foreach (MonoDomainFunc func, gpointer user_data);
154 mono_domain_assembly_open (MonoDomain *domain, const char *name);
157 mono_domain_finalize (MonoDomain *domain);
160 mono_domain_unload (MonoDomain *domain, gboolean force);
163 mono_domain_has_type_resolve (MonoDomain *domain);
165 MonoReflectionAssembly *
166 mono_domain_try_type_resolve (MonoDomain *domain, char *name, MonoObject *tb);
169 mono_jit_info_table_add (MonoDomain *domain, MonoJitInfo *ji);
172 mono_jit_info_table_find (MonoDomain *domain, char *addr);
175 ves_icall_System_AppDomainSetup_InitAppDomainSetup (MonoAppDomainSetup *setup);
178 ves_icall_System_AppDomain_getCurDomain (void);
181 ves_icall_System_AppDomain_createDomain (MonoString *friendly_name,
182 MonoAppDomainSetup *setup);
185 ves_icall_System_AppDomain_GetData (MonoAppDomain *ad,
189 ves_icall_System_AppDomain_SetData (MonoAppDomain *ad,
194 ves_icall_System_AppDomain_getSetup (MonoAppDomain *ad);
197 ves_icall_System_AppDomain_getFriendlyName (MonoAppDomain *ad);
200 ves_icall_System_AppDomain_GetAssemblies (MonoAppDomain *ad);
202 MonoReflectionAssembly *
203 ves_icall_System_Reflection_Assembly_LoadFrom (MonoString *fname);
205 MonoReflectionAssembly *
206 ves_icall_System_AppDomain_LoadAssembly (MonoAppDomain *ad,
207 MonoReflectionAssemblyName *assRef,
208 MonoObject *evidence);
211 ves_icall_System_AppDomain_InternalUnload (gint32 domain_id);
214 ves_icall_System_AppDomain_ExecuteAssembly (MonoAppDomain *ad,
216 MonoObject *evidence,
220 mono_context_init (MonoDomain *domain);
223 mono_context_set (MonoAppContext *new_context);
225 inline MonoAppContext *
226 mono_context_get (void);
229 ves_icall_System_AppDomain_InternalSetDomain (MonoAppDomain *ad);
232 ves_icall_System_AppDomain_InternalSetDomainByID (gint32 domainid);
235 ves_icall_System_AppDomain_InternalGetContext (void);
238 ves_icall_System_AppDomain_InternalGetDefaultContext (void);
241 ves_icall_System_AppDomain_InternalSetContext (MonoAppContext *mc);
244 ves_icall_System_AppDomain_GetIDFromDomain (MonoAppDomain * ad);
247 ves_icall_System_AppDomain_InternalGetProcessGuid (MonoString* newguid);
250 #endif /* _MONO_METADATA_APPDOMAIN_H_ */