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__
24 static inline void MSCOREE_LockModule(void) { InterlockedIncrement(&dll_refs); }
25 static inline void MSCOREE_UnlockModule(void) { InterlockedDecrement(&dll_refs); }
27 extern char *WtoA(LPCWSTR wstr);
29 extern HRESULT CLRMetaHost_CreateInstance(REFIID riid, void **ppobj);
31 extern HRESULT WINAPI CLRMetaHost_GetVersionFromFile(ICLRMetaHost* iface,
32 LPCWSTR pwzFilePath, LPWSTR pwzBuffer, DWORD *pcchBuffer);
34 typedef struct tagASSEMBLY ASSEMBLY;
36 HRESULT assembly_create(ASSEMBLY **out, LPCWSTR file);
37 HRESULT assembly_release(ASSEMBLY *assembly);
38 HRESULT assembly_get_runtime_version(ASSEMBLY *assembly, LPSTR *version);
40 typedef struct RuntimeHost RuntimeHost;
42 typedef struct CLRRuntimeInfo
44 const struct ICLRRuntimeInfoVtbl *ICLRRuntimeInfo_vtbl;
50 WCHAR mono_path[MAX_PATH];
51 WCHAR mscorlib_path[MAX_PATH];
52 struct RuntimeHost *loaded_runtime;
55 extern HRESULT get_runtime_info(LPCWSTR exefile, LPCWSTR version, LPCWSTR config_file,
56 DWORD startup_flags, DWORD runtimeinfo_flags, BOOL legacy, ICLRRuntimeInfo **result);
58 extern HRESULT force_get_runtime_info(ICLRRuntimeInfo **result);
60 extern HRESULT ICLRRuntimeInfo_GetRuntimeHost(ICLRRuntimeInfo *iface, RuntimeHost **result);
62 extern HRESULT MetaDataDispenser_CreateInstance(IUnknown **ppUnk);
64 typedef struct parsed_config_file
66 struct list supported_runtimes;
69 typedef struct supported_runtime
75 extern HRESULT parse_config_file(LPCWSTR filename, parsed_config_file *result);
77 extern void free_parsed_config_file(parsed_config_file *file);
80 typedef struct _MonoDomain MonoDomain;
81 typedef struct _MonoAssembly MonoAssembly;
82 typedef struct _MonoAssemblyName MonoAssemblyName;
83 typedef struct _MonoType MonoType;
84 typedef struct _MonoImage MonoImage;
85 typedef struct _MonoClass MonoClass;
86 typedef struct _MonoObject MonoObject;
87 typedef struct _MonoMethod MonoMethod;
91 MONO_IMAGE_ERROR_ERRNO,
92 MONO_IMAGE_MISSING_ASSEMBLYREF,
93 MONO_IMAGE_IMAGE_INVALID
94 } MonoImageOpenStatus;
96 typedef MonoAssembly* (*MonoAssemblyPreLoadFunc)(MonoAssemblyName *aname, char **assemblies_path, void *user_data);
98 typedef struct loaded_mono
103 MonoImage* (CDECL *mono_assembly_get_image)(MonoAssembly *assembly);
104 MonoAssembly* (CDECL *mono_assembly_open)(const char *filename, MonoImageOpenStatus *status);
105 MonoClass* (CDECL *mono_class_from_mono_type)(MonoType *type);
106 MonoClass* (CDECL *mono_class_from_name)(MonoImage *image, const char* name_space, const char *name);
107 MonoMethod* (CDECL *mono_class_get_method_from_name)(MonoClass *klass, const char *name, int param_count);
108 void (CDECL *mono_config_parse)(const char *filename);
109 MonoAssembly* (CDECL *mono_domain_assembly_open) (MonoDomain *domain, const char *name);
110 void (CDECL *mono_free)(void *);
111 void (CDECL *mono_install_assembly_preload_hook)(MonoAssemblyPreLoadFunc func, void *user_data);
112 void (CDECL *mono_jit_cleanup)(MonoDomain *domain);
113 int (CDECL *mono_jit_exec)(MonoDomain *domain, MonoAssembly *assembly, int argc, char *argv[]);
114 MonoDomain* (CDECL *mono_jit_init)(const char *file);
115 int (CDECL *mono_jit_set_trace_options)(const char* options);
116 MonoDomain* (CDECL *mono_object_get_domain)(MonoObject *obj);
117 MonoObject* (CDECL *mono_object_new)(MonoDomain *domain, MonoClass *klass);
118 void* (CDECL *mono_object_unbox)(MonoObject *obj);
119 MonoType* (CDECL *mono_reflection_type_from_name)(char *name, MonoImage *image);
120 MonoObject* (CDECL *mono_runtime_invoke)(MonoMethod *method, void *obj, void **params, MonoObject **exc);
121 void (CDECL *mono_runtime_object_init)(MonoObject *this_obj);
122 void (CDECL *mono_set_dirs)(const char *assembly_dir, const char *config_dir);
123 char* (CDECL *mono_stringify_assembly_name)(MonoAssemblyName *aname);
126 /* loaded runtime interfaces */
127 extern void unload_all_runtimes(void);
129 extern HRESULT RuntimeHost_Construct(const CLRRuntimeInfo *runtime_version,
130 const loaded_mono *loaded_mono, RuntimeHost** result);
132 extern HRESULT RuntimeHost_GetInterface(RuntimeHost *This, REFCLSID clsid, REFIID riid, void **ppv);
134 extern HRESULT RuntimeHost_GetIUnknownForObject(RuntimeHost *This, MonoObject *obj, IUnknown **ppUnk);
136 extern HRESULT RuntimeHost_CreateManagedInstance(RuntimeHost *This, LPCWSTR name,
137 MonoDomain *domain, MonoObject **result);
139 extern HRESULT RuntimeHost_Destroy(RuntimeHost *This);
141 #endif /* __MSCOREE_PRIVATE__ */