[change] RuntimeApi::GetInterpreterThreadFrameStackSize 之类的函数在Editor下为空非extern函数,避免Editor下调用时出错

main
walon 2023-07-03 22:52:56 +08:00
parent 058270c658
commit 1d09f72460
1 changed files with 37 additions and 3 deletions

View File

@ -42,36 +42,70 @@ namespace HybridCLR
/// <param name="dllBytes"></param> /// <param name="dllBytes"></param>
/// <param name="dllSize"></param> /// <param name="dllSize"></param>
/// <returns></returns> /// <returns></returns>
#if UNITY_EDITOR
public static unsafe int LoadMetadataForAOTAssembly(byte* dllBytes, int dllSize, int mode)
{
return 0;
}
#else
[DllImport(dllName, EntryPoint = "RuntimeApi_LoadMetadataForAOTAssembly")] [DllImport(dllName, EntryPoint = "RuntimeApi_LoadMetadataForAOTAssembly")]
public static extern unsafe int LoadMetadataForAOTAssembly(byte* dllBytes, int dllSize, int mode); public static extern unsafe int LoadMetadataForAOTAssembly(byte* dllBytes, int dllSize, int mode);
#endif
/// <summary> /// <summary>
/// 获取解释器线程栈的最大StackObject个数(size*8 为最终占用的内存大小) /// 获取解释器线程栈的最大StackObject个数(size*8 为最终占用的内存大小)
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
#if UNITY_EDITOR
public static int GetInterpreterThreadObjectStackSize()
{
return 0;
}
#else
[DllImport(dllName, EntryPoint = "RuntimeApi_GetInterpreterThreadObjectStackSize")] [DllImport(dllName, EntryPoint = "RuntimeApi_GetInterpreterThreadObjectStackSize")]
public static extern int GetInterpreterThreadObjectStackSize(); public static extern int GetInterpreterThreadObjectStackSize();
#endif
/// <summary> /// <summary>
/// 设置解释器线程栈的最大StackObject个数(size*8 为最终占用的内存大小) /// 设置解释器线程栈的最大StackObject个数(size*8 为最终占用的内存大小)
/// </summary> /// </summary>
/// <param name="size"></param> /// <param name="size"></param>
#if UNITY_EDITOR
public static void SetInterpreterThreadObjectStackSize(int size)
{
}
#else
[DllImport(dllName, EntryPoint = "RuntimeApi_SetInterpreterThreadObjectStackSize")] [DllImport(dllName, EntryPoint = "RuntimeApi_SetInterpreterThreadObjectStackSize")]
public static extern void SetInterpreterThreadObjectStackSize(int size); public static extern void SetInterpreterThreadObjectStackSize(int size);
#endif
/// <summary> /// <summary>
/// 获取解释器线程函数帧数量(sizeof(InterpreterFrame)*size 为最终占用的内存大小) /// 获取解释器线程函数帧数量(sizeof(InterpreterFrame)*size 为最终占用的内存大小)
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
#if UNITY_EDITOR
public static int GetInterpreterThreadFrameStackSize()
{
return 0;
}
#else
[DllImport(dllName, EntryPoint = "RuntimeApi_GetInterpreterThreadFrameStackSize")] [DllImport(dllName, EntryPoint = "RuntimeApi_GetInterpreterThreadFrameStackSize")]
public static extern int GetInterpreterThreadFrameStackSize(); public static extern int GetInterpreterThreadFrameStackSize();
#endif
/// <summary> /// <summary>
/// 设置解释器线程函数帧数量(sizeof(InterpreterFrame)*size 为最终占用的内存大小) /// 设置解释器线程函数帧数量(sizeof(InterpreterFrame)*size 为最终占用的内存大小)
/// </summary> /// </summary>
/// <param name="size"></param> /// <param name="size"></param>
#if UNITY_EDITOR
public static void SetInterpreterThreadFrameStackSize(int size)
{
}
#else
[DllImport(dllName, EntryPoint = "RuntimeApi_SetInterpreterThreadFrameStackSize")] [DllImport(dllName, EntryPoint = "RuntimeApi_SetInterpreterThreadFrameStackSize")]
public static extern void SetInterpreterThreadFrameStackSize(int size); public static extern void SetInterpreterThreadFrameStackSize(int size);
#endif
} }
} }