-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdriver.c
77 lines (61 loc) · 2.32 KB
/
driver.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
// Uncomment if you have a copy of the Mono headers in your include path.
// #define HAVE_MONO_SRC 1
#ifdef HAVE_MONO_SRC
#include <mono/mini/jit.h>
#include <mono/metadata/class.h>
#include <mono/metadata/assembly.h>
#include <mono/metadata/mono-debug.h>
#define HAS_MONO_IMPORTS
#endif
// Header generated by psbuild
//#include "aot/mono-aot.h"
typedef struct _MonoAssembly MonoAssembly;
typedef struct _MonoDomain MonoDomain;
typedef int MonoImageOpenStatus;
// FIXME: Use the actual headers
typedef enum { MONO_AOT_MODE_LLVMONLY = 4 } MonoAotMode;
extern void mono_jit_set_aot_mode (MonoAotMode mode);
extern void mono_aot_register_module (void *aot_info);
extern MonoDomain* mono_jit_init_version (const char *root_domain_name, const char *runtime_version);
extern int mono_jit_exec (MonoDomain *domain, MonoAssembly *assembly, int argc, char *argv[]);
extern MonoAssembly* mono_assembly_open (const char *filename, MonoImageOpenStatus *status);
extern MonoDomain *mono_domain_get (void);
void emscripten_setup ()
{
}
const char *assembly_path = "/";
const char *main_assembly_name = "program";
extern void *mono_aot_module_program_info;
extern void *mono_aot_module_mscorlib_info;
//extern void *mono_aot_module_System_info;
//extern void *mono_aot_module_System_Xml_info;
void emscripten_register_modules ()
{
mono_aot_register_module (mono_aot_module_program_info);
mono_aot_register_module (mono_aot_module_mscorlib_info);
//mono_aot_register_module (mono_aot_module_System_info);
//mono_aot_register_module (mono_aot_module_System_Xml_info);
}
int main (int argc, char *argv[])
{
MonoAssembly *assembly;
int result;
printf ("Test project booted\n");
setenv ("MONO_PATH", assembly_path, 1); /*FIXME this doesn't affect the location in main_assembly_name */
setenv ("MONO_GC_PARAMS", "nursery-size=512k", 1);
setenv ("MONO_LOG_LEVEL", "debug", 1);
setenv ("MONO_LOG_MASK", "aot,asm");
//g_setenv ("MONO_GC_DEBUG", "2", 1);
//loadLib ();
emscripten_register_modules ();
mono_jit_set_aot_mode (MONO_AOT_MODE_LLVMONLY);
//debugger_setup ();
mono_jit_init_version ("Emscripten", "v4.0.30319");
assembly = mono_assembly_open (main_assembly_name, NULL);
result = mono_jit_exec (mono_domain_get (), assembly, argc, argv);
printf ("Test project complete\n");
return result;
}