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
;
36 typedef struct RuntimeHost RuntimeHost
;
38 typedef struct CLRRuntimeInfo
40 const struct ICLRRuntimeInfoVtbl
*ICLRRuntimeInfo_vtbl
;
46 WCHAR mono_path
[MAX_PATH
];
47 WCHAR mscorlib_path
[MAX_PATH
];
48 struct RuntimeHost
*loaded_runtime
;
51 extern HRESULT
get_runtime_info(LPCWSTR exefile
, LPCWSTR version
, LPCWSTR config_file
,
52 DWORD startup_flags
, DWORD runtimeinfo_flags
, BOOL legacy
, ICLRRuntimeInfo
**result
) DECLSPEC_HIDDEN
;
54 extern HRESULT
ICLRRuntimeInfo_GetRuntimeHost(ICLRRuntimeInfo
*iface
, RuntimeHost
**result
) DECLSPEC_HIDDEN
;
56 extern HRESULT
MetaDataDispenser_CreateInstance(IUnknown
**ppUnk
) DECLSPEC_HIDDEN
;
58 typedef struct parsed_config_file
60 struct list supported_runtimes
;
63 typedef struct supported_runtime
69 extern HRESULT
parse_config_file(LPCWSTR filename
, parsed_config_file
*result
) DECLSPEC_HIDDEN
;
71 extern void free_parsed_config_file(parsed_config_file
*file
) DECLSPEC_HIDDEN
;
74 typedef struct _MonoDomain MonoDomain
;
75 typedef struct _MonoAssembly MonoAssembly
;
76 typedef struct _MonoAssemblyName MonoAssemblyName
;
77 typedef struct _MonoType MonoType
;
78 typedef struct _MonoImage MonoImage
;
79 typedef struct _MonoClass MonoClass
;
80 typedef struct _MonoObject MonoObject
;
81 typedef struct _MonoMethod MonoMethod
;
82 typedef struct _MonoProfiler MonoProfiler
;
86 MONO_IMAGE_ERROR_ERRNO
,
87 MONO_IMAGE_MISSING_ASSEMBLYREF
,
88 MONO_IMAGE_IMAGE_INVALID
89 } MonoImageOpenStatus
;
91 typedef MonoAssembly
* (*MonoAssemblyPreLoadFunc
)(MonoAssemblyName
*aname
, char **assemblies_path
, void *user_data
);
93 typedef void (*MonoProfileFunc
)(MonoProfiler
*prof
);
95 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 int (CDECL
*mono_jit_exec
)(MonoDomain
*domain
, MonoAssembly
*assembly
, int argc
, char *argv
[]);
113 MonoDomain
* (CDECL
*mono_jit_init
)(const char *file
);
114 int (CDECL
*mono_jit_set_trace_options
)(const char* options
);
115 MonoDomain
* (CDECL
*mono_object_get_domain
)(MonoObject
*obj
);
116 MonoObject
* (CDECL
*mono_object_new
)(MonoDomain
*domain
, MonoClass
*klass
);
117 void* (CDECL
*mono_object_unbox
)(MonoObject
*obj
);
118 void (CDECL
*mono_profiler_install
)(MonoProfiler
*prof
, MonoProfileFunc shutdown_callback
);
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_runtime_quit
)(void);
123 void (CDECL
*mono_runtime_set_shutting_down
)(void);
124 void (CDECL
*mono_set_dirs
)(const char *assembly_dir
, const char *config_dir
);
125 char* (CDECL
*mono_stringify_assembly_name
)(MonoAssemblyName
*aname
);
126 void (CDECL
*mono_thread_pool_cleanup
)(void);
127 void (CDECL
*mono_thread_suspend_all_other_threads
)(void);
128 void (CDECL
*mono_threads_set_shutting_down
)(void);
131 /* loaded runtime interfaces */
132 extern void unload_all_runtimes(void) DECLSPEC_HIDDEN
;
134 extern void expect_no_runtimes(void) DECLSPEC_HIDDEN
;
136 extern HRESULT
RuntimeHost_Construct(const CLRRuntimeInfo
*runtime_version
,
137 loaded_mono
*loaded_mono
, RuntimeHost
** result
) DECLSPEC_HIDDEN
;
139 extern HRESULT
RuntimeHost_GetInterface(RuntimeHost
*This
, REFCLSID clsid
, REFIID riid
, void **ppv
) DECLSPEC_HIDDEN
;
141 extern HRESULT
RuntimeHost_GetIUnknownForObject(RuntimeHost
*This
, MonoObject
*obj
, IUnknown
**ppUnk
) DECLSPEC_HIDDEN
;
143 extern HRESULT
RuntimeHost_CreateManagedInstance(RuntimeHost
*This
, LPCWSTR name
,
144 MonoDomain
*domain
, MonoObject
**result
) DECLSPEC_HIDDEN
;
146 extern HRESULT
RuntimeHost_Destroy(RuntimeHost
*This
) DECLSPEC_HIDDEN
;
148 #endif /* __MSCOREE_PRIVATE__ */