forked from loongly/PureScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathScriptEngine.cs
More file actions
51 lines (43 loc) · 1.45 KB
/
ScriptEngine.cs
File metadata and controls
51 lines (43 loc) · 1.45 KB
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
using System.Runtime.InteropServices;
using System;
using System.Reflection;
namespace PureScript.Mono
{
public class ScriptEngine
{
#if IOS
const string XMONO_LIB = "__Internal";
#else
const string XMONO_LIB = "ScriptEngine";
#endif
[DllImport(XMONO_LIB, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr GetFuncPointer();
[DllImport(XMONO_LIB, EntryPoint = "OnExceptionMono", CallingConvention = CallingConvention.Cdecl)]
public static extern void OnException(string msg);
[DllImport(XMONO_LIB, EntryPoint = "CheckExceptionIl2cpp", CallingConvention = CallingConvention.Cdecl)]
public static extern void CheckException();
private static int Main(string[] args)
{
var ptr = GetFuncPointer();
//MonoBind.InitBind(GetFuncPointer());
if (args.Length > 0)
{
var dllPath = args[0];
Assembly assembly = Assembly.Load(dllPath);
Type type = assembly.GetType("MonoEntry");
MethodInfo mi = type.GetMethod("Main");
var res = mi.Invoke(null, null);
}
return 0;
}
}
[AttributeUsage(AttributeTargets.All)]
public class WrapperClassAttribute : Attribute
{
public string OrignAsm;
public WrapperClassAttribute(string orignAsm)
{
OrignAsm = orignAsm;
}
}
}