RuntimeApi.cs 1.3 KB

123456789101112131415161718192021222324252627282930313233343536
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Reflection;
  5. using System.Runtime.InteropServices;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. namespace HybridCLR
  9. {
  10. public static class RuntimeApi
  11. {
  12. #if UNITY_STANDALONE_WIN
  13. private const string dllName = "GameAssembly";
  14. #elif UNITY_IOS || UNITY_STANDALONE_OSX || UNITY_WEBGL
  15. private const string dllName = "__Internal";
  16. #else
  17. private const string dllName = "il2cpp";
  18. #endif
  19. [DllImport(dllName, EntryPoint = "RuntimeApi_LoadMetadataForAOTAssembly")]
  20. public static extern int LoadMetadataForAOTAssembly(IntPtr dllBytes, int dllSize);
  21. [DllImport(dllName, EntryPoint = "RuntimeApi_GetInterpreterThreadObjectStackSize")]
  22. public static extern int GetInterpreterThreadObjectStackSize();
  23. [DllImport(dllName, EntryPoint = "RuntimeApi_SetInterpreterThreadObjectStackSize")]
  24. public static extern void SetInterpreterThreadObjectStackSize(int size);
  25. [DllImport(dllName, EntryPoint = "RuntimeApi_GetInterpreterThreadFrameStackSize")]
  26. public static extern int GetInterpreterThreadFrameStackSize();
  27. [DllImport(dllName, EntryPoint = "RuntimeApi_SetInterpreterThreadFrameStackSize")]
  28. public static extern void SetInterpreterThreadFrameStackSize(int size);
  29. }
  30. }