3 * Copyright 2008 Alistair Leslie-Hughes
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 #ifndef __MSCOREE_PRIVATE__
21 #define __MSCOREE_PRIVATE__
23 extern char *WtoA(LPCWSTR wstr) DECLSPEC_HIDDEN;
25 extern HRESULT CLRMetaHost_CreateInstance(REFIID riid, void **ppobj) DECLSPEC_HIDDEN;
27 extern HRESULT WINAPI CLRMetaHost_GetVersionFromFile(ICLRMetaHost* iface,
28 LPCWSTR pwzFilePath, LPWSTR pwzBuffer, DWORD *pcchBuffer) DECLSPEC_HIDDEN;
30 typedef struct tagASSEMBLY ASSEMBLY;
32 HRESULT assembly_create(ASSEMBLY **out, LPCWSTR file) DECLSPEC_HIDDEN;
33 HRESULT assembly_release(ASSEMBLY *assembly) DECLSPEC_HIDDEN;
34 HRESULT assembly_get_runtime_version(ASSEMBLY *assembly, LPSTR *version) DECLSPEC_HIDDEN;
37 typedef struct _MonoDomain MonoDomain;
38 typedef struct _MonoAssembly MonoAssembly;
39 typedef struct _MonoAssemblyName MonoAssemblyName;
40 typedef struct _MonoType MonoType;
41 typedef struct _MonoImage MonoImage;
42 typedef struct _MonoClass MonoClass;
43 typedef struct _MonoObject MonoObject;
44 typedef struct _MonoMethod MonoMethod;
45 typedef struct _MonoProfiler MonoProfiler;
47 typedef struct loaded_mono loaded_mono;
48 typedef struct RuntimeHost RuntimeHost;
50 typedef struct CLRRuntimeInfo
52 ICLRRuntimeInfo ICLRRuntimeInfo_iface;
58 WCHAR mono_path[MAX_PATH];
59 WCHAR mscorlib_path[MAX_PATH];
60 struct RuntimeHost *loaded_runtime;
65 ICorRuntimeHost ICorRuntimeHost_iface;
66 ICLRRuntimeHost ICLRRuntimeHost_iface;
67 const CLRRuntimeInfo *version;
70 MonoDomain *default_domain;
71 CRITICAL_SECTION lock;
75 typedef struct CorProcess
78 ICorDebugProcess *pProcess;
81 typedef struct CorDebug
83 ICorDebug ICorDebug_iface;
84 ICorDebugProcessEnum ICorDebugProcessEnum_iface;
87 ICLRRuntimeHost *runtimehost;
89 /* ICorDebug Callback */
90 ICorDebugManagedCallback *pCallback;
91 ICorDebugManagedCallback2 *pCallback2;
94 struct list processes;
97 extern HRESULT get_runtime_info(LPCWSTR exefile, LPCWSTR version, LPCWSTR config_file,
98 DWORD startup_flags, DWORD runtimeinfo_flags, BOOL legacy, ICLRRuntimeInfo **result) DECLSPEC_HIDDEN;
100 extern HRESULT ICLRRuntimeInfo_GetRuntimeHost(ICLRRuntimeInfo *iface, RuntimeHost **result) DECLSPEC_HIDDEN;
102 extern HRESULT MetaDataDispenser_CreateInstance(IUnknown **ppUnk) DECLSPEC_HIDDEN;
104 typedef struct parsed_config_file
106 struct list supported_runtimes;
107 } parsed_config_file;
109 typedef struct supported_runtime
115 extern HRESULT parse_config_file(LPCWSTR filename, parsed_config_file *result) DECLSPEC_HIDDEN;
117 extern void free_parsed_config_file(parsed_config_file *file) DECLSPEC_HIDDEN;
121 MONO_IMAGE_ERROR_ERRNO,
122 MONO_IMAGE_MISSING_ASSEMBLYREF,
123 MONO_IMAGE_IMAGE_INVALID
124 } MonoImageOpenStatus;
126 typedef MonoAssembly* (*MonoAssemblyPreLoadFunc)(MonoAssemblyName *aname, char **assemblies_path, void *user_data);
128 typedef void (*MonoProfileFunc)(MonoProfiler *prof);
138 MonoImage* (CDECL *mono_assembly_get_image)(MonoAssembly *assembly);
139 MonoAssembly* (CDECL *mono_assembly_open)(const char *filename, MonoImageOpenStatus *status);
140 MonoClass* (CDECL *mono_class_from_mono_type)(MonoType *type);
141 MonoClass* (CDECL *mono_class_from_name)(MonoImage *image, const char* name_space, const char *name);
142 MonoMethod* (CDECL *mono_class_get_method_from_name)(MonoClass *klass, const char *name, int param_count);
143 void (CDECL *mono_config_parse)(const char *filename);
144 MonoAssembly* (CDECL *mono_domain_assembly_open) (MonoDomain *domain, const char *name);
145 void (CDECL *mono_free)(void *);
146 void (CDECL *mono_install_assembly_preload_hook)(MonoAssemblyPreLoadFunc func, void *user_data);
147 int (CDECL *mono_jit_exec)(MonoDomain *domain, MonoAssembly *assembly, int argc, char *argv[]);
148 MonoDomain* (CDECL *mono_jit_init)(const char *file);
149 int (CDECL *mono_jit_set_trace_options)(const char* options);
150 MonoDomain* (CDECL *mono_object_get_domain)(MonoObject *obj);
151 MonoObject* (CDECL *mono_object_new)(MonoDomain *domain, MonoClass *klass);
152 void* (CDECL *mono_object_unbox)(MonoObject *obj);
153 void (CDECL *mono_profiler_install)(MonoProfiler *prof, MonoProfileFunc shutdown_callback);
154 MonoType* (CDECL *mono_reflection_type_from_name)(char *name, MonoImage *image);
155 MonoObject* (CDECL *mono_runtime_invoke)(MonoMethod *method, void *obj, void **params, MonoObject **exc);
156 void (CDECL *mono_runtime_object_init)(MonoObject *this_obj);
157 void (CDECL *mono_runtime_quit)(void);
158 void (CDECL *mono_runtime_set_shutting_down)(void);
159 void (CDECL *mono_set_dirs)(const char *assembly_dir, const char *config_dir);
160 char* (CDECL *mono_stringify_assembly_name)(MonoAssemblyName *aname);
161 void (CDECL *mono_thread_pool_cleanup)(void);
162 void (CDECL *mono_thread_suspend_all_other_threads)(void);
163 void (CDECL *mono_threads_set_shutting_down)(void);
166 /* loaded runtime interfaces */
167 extern void unload_all_runtimes(void) DECLSPEC_HIDDEN;
169 extern void expect_no_runtimes(void) DECLSPEC_HIDDEN;
171 extern HRESULT RuntimeHost_Construct(const CLRRuntimeInfo *runtime_version,
172 loaded_mono *loaded_mono, RuntimeHost** result) DECLSPEC_HIDDEN;
174 extern HRESULT RuntimeHost_GetInterface(RuntimeHost *This, REFCLSID clsid, REFIID riid, void **ppv) DECLSPEC_HIDDEN;
176 extern HRESULT RuntimeHost_GetIUnknownForObject(RuntimeHost *This, MonoObject *obj, IUnknown **ppUnk) DECLSPEC_HIDDEN;
178 extern HRESULT RuntimeHost_CreateManagedInstance(RuntimeHost *This, LPCWSTR name,
179 MonoDomain *domain, MonoObject **result) DECLSPEC_HIDDEN;
181 extern HRESULT RuntimeHost_Destroy(RuntimeHost *This) DECLSPEC_HIDDEN;
183 HRESULT WINAPI CLRMetaHost_GetRuntime(ICLRMetaHost* iface, LPCWSTR pwzVersion, REFIID iid, LPVOID *ppRuntime) DECLSPEC_HIDDEN;
185 extern HRESULT CorDebug_Create(ICLRRuntimeHost *runtimehost, IUnknown** ppUnk) DECLSPEC_HIDDEN;
187 #endif /* __MSCOREE_PRIVATE__ */