[fix] 修复计算Native2Manager桥接函数未考虑到MonoPInvokeCallback函数,导致从lua或者其他语言调用c#热更新函数有时候会出现UnsupportedNative2ManagedMethod的bug
parent
e4cf9e9086
commit
303c6c7b35
|
@ -15,6 +15,7 @@ using UnityEditor;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using TypeInfo = HybridCLR.Editor.ABI.TypeInfo;
|
using TypeInfo = HybridCLR.Editor.ABI.TypeInfo;
|
||||||
using CallingConvention = System.Runtime.InteropServices.CallingConvention;
|
using CallingConvention = System.Runtime.InteropServices.CallingConvention;
|
||||||
|
using System.Security.Cryptography;
|
||||||
|
|
||||||
namespace HybridCLR.Editor.MethodBridge
|
namespace HybridCLR.Editor.MethodBridge
|
||||||
{
|
{
|
||||||
|
@ -181,12 +182,23 @@ namespace HybridCLR.Editor.MethodBridge
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void PrepareGenericMethods()
|
private void PrepareMethodBridges()
|
||||||
{
|
{
|
||||||
foreach (var method in _genericMethods)
|
foreach (var method in _genericMethods)
|
||||||
{
|
{
|
||||||
ProcessMethod(method.Method, method.KlassInst, method.MethodInst);
|
ProcessMethod(method.Method, method.KlassInst, method.MethodInst);
|
||||||
}
|
}
|
||||||
|
foreach (var reversePInvokeMethod in _originalReversePInvokeMethods)
|
||||||
|
{
|
||||||
|
MethodDef method = reversePInvokeMethod.Method;
|
||||||
|
ICorLibTypes corLibTypes = method.Module.CorLibTypes;
|
||||||
|
|
||||||
|
var returnType = MetaUtil.ToShareTypeSig(corLibTypes, method.ReturnType);
|
||||||
|
var parameters = method.Parameters.Select(p => MetaUtil.ToShareTypeSig(corLibTypes, p.Type)).ToList();
|
||||||
|
var sharedMethod = CreateMethodDesc(method, true, returnType, parameters);
|
||||||
|
sharedMethod.Init();
|
||||||
|
AddNative2ManagedMethod(sharedMethod);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void CheckUnique(IEnumerable<string> names)
|
static void CheckUnique(IEnumerable<string> names)
|
||||||
|
@ -595,7 +607,7 @@ const ReversePInvokeMethodData hybridclr::interpreter::g_reversePInvokeMethodStu
|
||||||
|
|
||||||
public void Generate()
|
public void Generate()
|
||||||
{
|
{
|
||||||
PrepareGenericMethods();
|
PrepareMethodBridges();
|
||||||
CollectTypesAndMethods();
|
CollectTypesAndMethods();
|
||||||
OptimizationTypesAndMethods();
|
OptimizationTypesAndMethods();
|
||||||
GenerateCode();
|
GenerateCode();
|
||||||
|
|
Loading…
Reference in New Issue