loongly / purescript Goto Github PK
View Code? Open in Web Editor NEWA C# hot reload framework for Unity3D, based on Mono's MONO_AOT_MODE_INTERP mode.
License: MIT License
A C# hot reload framework for Unity3D, based on Mono's MONO_AOT_MODE_INTERP mode.
License: MIT License
例如:
public class TestArgs
{
public string name;
}
public class TestClassA
{
public delegate System.EventHandler<TestArgs> testDelegate;
}
testDelegate展开之后类型是 EventHandler(object sender, TestArgs e),此delegate含有两个参数,但是目前会错误的只包含了一个TestArgs类型的参数。
记录一些新功能计划
可否在生成了wrapper class的dll之后,再生成一次运行在mono层的dll,这样可以在编译时就发现问题,防止到运行之后的crash问题。
binder.json 的CSharpIgnorTypes可以产生类似的问题,如果配置了某些被忽略的type,但是这些在mono层被引用到了,运行中如果某个地方引用到了相关的成员或者函数,会产生crash,而构建过程中这些问题不会暴露出来。
Android、iOS都搞成mono mixed的吧
用安卓il2cpp 模式下 启动mono 虚拟机之后会crash ,现在还更新了吗
是否可以考虑直接集成WObject相关的功能到System.Object内,利用mono的提供的C#代码重新编译一个mscorlib.dll,这样可以提高通用性。
如果项目内没有引用到MonoPInvokeCallbackAttribute,会在导出工程时被裁剪掉,导致Adapter.gen.dll的编译错误。
例如这个class:
public class TestDelegateAsCtorArg
{
public delegate void Callback();
public TestDelegateAsCtorArg(Callback callback)
{
SetCallBack(callback);
}
public void SetCallBack(Callback callback)
{
if(callback != null)
{
callback();
}
}
}
生成的wrapper class的代码:
......
public global::TestDelegateAsCtorArg.Callback _TestDelegateAsCtorArg__ctor_callback;
public GCHandle _TestDelegateAsCtorArg__ctor_callback_ref;
static Delegate5605cacf TestDelegateAsCtorArg__ctor_callbackAction = OnTestDelegateAsCtorArg__ctor_callback;
static void OnTestDelegateAsCtorArg__ctor_callback(IntPtr arg0_h)
{
Exception __e = null;
try
{
var arg0Obj = ObjectStore.Get<global::TestDelegateAsCtorArg>(arg0_h);
arg0Obj._TestDelegateAsCtorArg__ctor_callback();
}
catch(Exception e)
{
__e = e;
}
if(__e != null)
ScriptEngine.OnException(__e.ToString());
}
public global::TestDelegateAsCtorArg.Callback _TestDelegateAsCtorArg_SetCallBack_callback;
public GCHandle _TestDelegateAsCtorArg_SetCallBack_callback_ref;
static Delegate5605cacf TestDelegateAsCtorArg_SetCallBack_callbackAction = OnTestDelegateAsCtorArg_SetCallBack_callback;
static void OnTestDelegateAsCtorArg_SetCallBack_callback(IntPtr arg0_h)
{
Exception __e = null;
try
{
var arg0Obj = ObjectStore.Get<global::TestDelegateAsCtorArg>(arg0_h);
arg0Obj._TestDelegateAsCtorArg_SetCallBack_callback();
}
catch(Exception e)
{
__e = e;
}
if(__e != null)
ScriptEngine.OnException(__e.ToString());
}
......
public TestDelegateAsCtorArg(Callback callback)
{
if(typeof(TestDelegateAsCtorArg) == GetWType())
{
var TestDelegateAsCtorArg__ctor_callback_p = Marshal.GetFunctionPointerForDelegate(TestDelegateAsCtorArg__ctor_callbackAction);
var h = MonoBind.TestDelegateAsCtorArg__ctor_6(TestDelegateAsCtorArg__ctor_callback_p);
ScriptEngine.CheckException();
SetHandle(h);
ObjectStore.Store(this, h);
}
}
public void SetCallBack(Callback callback)
{
_TestDelegateAsCtorArg_SetCallBack_callback = callback;
ObjectStore.RefMember(this,ref _TestDelegateAsCtorArg_SetCallBack_callback_ref,_TestDelegateAsCtorArg_SetCallBack_callback);
var TestDelegateAsCtorArg_SetCallBack_callback_p = Marshal.GetFunctionPointerForDelegate(TestDelegateAsCtorArg_SetCallBack_callbackAction);
MonoBind.TestDelegateAsCtorArg_SetCallBack(this.Handle, TestDelegateAsCtorArg_SetCallBack_callback_p);
ScriptEngine.CheckException();
return ;
}
生成的UnityBind的代码:
static Delegatef55bb3df _EventDelegate__ctor_call;
static void OnEventDelegate__ctor_call(this global::EventDelegate arg0)
{
var arg0_h = ObjectStore.Store(arg0);
_EventDelegate__ctor_call(arg0_h);
ScriptEngine.CheckException();
}
[MonoPInvokeCallback(typeof(EventDelegate__ctor_12_Type))]
static IntPtr EventDelegate__ctor_12 (IntPtr call_p)
{
Exception __e = null;
try
{
_EventDelegate__ctor_call = call_p == IntPtr.Zero ? null: Marshal.GetDelegateForFunctionPointer<Delegatef55bb3df>(call_p);
var _value = new global::EventDelegate(thizObj.OnEventDelegate__ctor_call); //语法错误
var _valueHandle = ObjectStore.Store(_value);
return _valueHandle;
}
catch(Exception _e_)
{
__e = _e_;
}
if(__e != null)
ScriptEngine.OnException(__e.ToString());
return default(IntPtr);
}
项目目前对于delegate的处理应该是将mono层传入的delegate作为function pointer,赋值给wrapper class的static成员。mono内的wrapper class传入的delegate没有正确赋值,UnityBInd内被封装之后的delegate的实例则依赖于class的实例来获得,而此时还在构造constructor的参数,无法获取到实例,导致最后生成的代码产生语法错误。
如题,顺便请教下有没有Q群号技术交流群,提供下加下好友
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.