[fix] 修复计算Native2Manager桥接函数未考虑到MonoPInvokeCallback函数,导致从lua或者其他语言调用c#热更新函数有时候会出现UnsupportedNative2ManagedMethod的bug
parent
e4cf9e9086
commit
303c6c7b35
|
@ -15,6 +15,7 @@ using UnityEditor;
|
|||
using UnityEngine;
|
||||
using TypeInfo = HybridCLR.Editor.ABI.TypeInfo;
|
||||
using CallingConvention = System.Runtime.InteropServices.CallingConvention;
|
||||
using System.Security.Cryptography;
|
||||
|
||||
namespace HybridCLR.Editor.MethodBridge
|
||||
{
|
||||
|
@ -181,12 +182,23 @@ namespace HybridCLR.Editor.MethodBridge
|
|||
}
|
||||
}
|
||||
|
||||
private void PrepareGenericMethods()
|
||||
private void PrepareMethodBridges()
|
||||
{
|
||||
foreach (var method in _genericMethods)
|
||||
{
|
||||
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)
|
||||
|
@ -595,7 +607,7 @@ const ReversePInvokeMethodData hybridclr::interpreter::g_reversePInvokeMethodStu
|
|||
|
||||
public void Generate()
|
||||
{
|
||||
PrepareGenericMethods();
|
||||
PrepareMethodBridges();
|
||||
CollectTypesAndMethods();
|
||||
OptimizationTypesAndMethods();
|
||||
GenerateCode();
|
||||
|
|
Loading…
Reference in New Issue