il2cpp-config.h 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635
  1. #pragma once
  2. #include <string.h>
  3. #define UNITY_ENGINE_TUANJIE 1
  4. #include "hybridclr/generated/UnityVersion.h"
  5. #if HYBRIDCLR_TUANJIE_VERSION >= 10301
  6. #define SUPPORT_METHOD_RETURN_TYPE_CUSTOM_ATTRIBUTE 1
  7. #endif
  8. /* first setup platform defines*/
  9. #include "os/c-api/il2cpp-config-platforms.h"
  10. #include "os/c-api/il2cpp-config-api-platforms.h"
  11. #include "il2cpp-config-api.h"
  12. #include "il2cpp-sanitizers.h"
  13. #ifdef LIBIL2CPP_EXPORT_CODEGEN_API
  14. # define LIBIL2CPP_CODEGEN_API IL2CPP_EXPORT
  15. #elif LIBIL2CPP_IMPORT_CODEGEN_API
  16. # define LIBIL2CPP_CODEGEN_API IL2CPP_IMPORT
  17. #else
  18. # define LIBIL2CPP_CODEGEN_API
  19. #endif
  20. #if defined(__ARMCC_VERSION)
  21. #include <wchar.h>
  22. #include <ctype.h>
  23. #define INTPTR_MAX 2147483647
  24. #endif
  25. //#if PLATFORM_WEIXINMINIGAME
  26. //#include "global_metadata_config.h" //it should be il2cpp output folder
  27. //#endif
  28. #if SLIM_GLOBAL_METADATA_FILE == 1
  29. #error "hybridclr doesn't support 'SLIM_GLOBAL_METADATA_FILE == 1' "
  30. #endif
  31. #ifndef IL2CPP_METHOD_ATTR
  32. #define IL2CPP_METHOD_ATTR
  33. #endif
  34. #if defined(_MSC_VER)
  35. #define IL2CPP_CXX_ABI_MSVC 1
  36. #else
  37. #define IL2CPP_CXX_ABI_MSVC 0
  38. #endif
  39. #if defined(__GNUC__)
  40. #define IL2CPP_GCC_VERSION (__GNUC__ * 10000 \
  41. + __GNUC_MINOR__ * 100 \
  42. + __GNU_PATCHLEVEL__)
  43. #endif
  44. typedef void (STDCALL *SynchronizationContextCallback)(intptr_t arg);
  45. typedef void (STDCALL *CultureInfoChangedCallback)(const Il2CppChar* arg);
  46. #if defined(__cplusplus)
  47. #define IL2CPP_EXTERN_C extern "C"
  48. #define IL2CPP_EXTERN_C_CONST extern "C" const
  49. #define IL2CPP_EXTERN_C_BEGIN extern "C" {
  50. #define IL2CPP_EXTERN_C_END }
  51. #else
  52. #define IL2CPP_EXTERN_C
  53. #define IL2CPP_EXTERN_C_CONST extern const
  54. #define IL2CPP_EXTERN_C_BEGIN
  55. #define IL2CPP_EXTERN_C_END
  56. #endif
  57. #if IL2CPP_COMPILER_MSVC || defined(__ARMCC_VERSION)
  58. #define IL2CPP_NO_INLINE __declspec(noinline)
  59. #define IL2CPP_NO_ALIAS __declspec(noalias)
  60. #define IL2CPP_PARAMETER_RESTRICT __restrict
  61. #define IL2CPP_METHOD_RESTRICT __declspec(restrict)
  62. #define IL2CPP_ASSUME(x) __assume(x)
  63. #else
  64. #define IL2CPP_NO_INLINE __attribute__ ((noinline))
  65. #define IL2CPP_NO_ALIAS
  66. #define IL2CPP_PARAMETER_RESTRICT
  67. #define IL2CPP_METHOD_RESTRICT
  68. #define IL2CPP_ASSUME(x)
  69. #endif
  70. #if IL2CPP_COMPILER_MSVC
  71. #define NOVTABLE __declspec(novtable)
  72. #else
  73. #define NOVTABLE
  74. #endif
  75. #define IL2CPP_ENABLE_MONO_BUG_EMULATION 1
  76. #ifndef ALIGN_OF // Baselib header can also define this - if so use their definition.
  77. #if defined(__GNUC__) || defined(__SNC__) || defined(__clang__)
  78. #define ALIGN_OF(T) __alignof__(T)
  79. #define ALIGN_TYPE(val) __attribute__((aligned(val)))
  80. #define ALIGN_FIELD(val) ALIGN_TYPE(val)
  81. // GCC earlier than 10.1 are unable to compile properly with the always_inline attribute
  82. #if defined(__GNUC__) && IL2CPP_GCC_VERSION < 100100
  83. #define IL2CPP_FORCE_INLINE inline
  84. #else
  85. #define IL2CPP_FORCE_INLINE inline __attribute__ ((always_inline))
  86. #endif
  87. #define IL2CPP_MANAGED_FORCE_INLINE IL2CPP_FORCE_INLINE
  88. #elif defined(_MSC_VER)
  89. #define ALIGN_OF(T) __alignof(T)
  90. #if _MSC_VER >= 1900 && defined(__cplusplus)
  91. #define ALIGN_TYPE(val) alignas(val)
  92. #else
  93. #define ALIGN_TYPE(val) __declspec(align(val))
  94. #endif
  95. #define ALIGN_FIELD(val) __declspec(align(val))
  96. #define IL2CPP_FORCE_INLINE __forceinline
  97. #define IL2CPP_MANAGED_FORCE_INLINE inline
  98. #else
  99. #define ALIGN_TYPE(size)
  100. #define ALIGN_FIELD(size)
  101. #define IL2CPP_FORCE_INLINE inline
  102. #define IL2CPP_MANAGED_FORCE_INLINE IL2CPP_FORCE_INLINE
  103. #endif
  104. #endif
  105. #define IL2CPP_PAGE_SIZE 4096
  106. // 64-bit types are aligned to 8 bytes on 64-bit platforms
  107. #define IL2CPP_ENABLE_INTERLOCKED_64_REQUIRED_ALIGNMENT (IL2CPP_SIZEOF_VOID_P == 8)
  108. /* Debugging */
  109. #ifndef IL2CPP_DEBUG
  110. #define IL2CPP_DEBUG 0
  111. #endif
  112. #ifndef IL2CPP_DEVELOPMENT
  113. #define IL2CPP_DEVELOPMENT 0
  114. #endif
  115. #ifndef ENABLE_HMI_MODE
  116. #define ENABLE_HMI_MODE 0
  117. #endif
  118. #define IL2CPP_THREADS_ALL_ACCESS (!IL2CPP_THREADS_STD && IL2CPP_TARGET_XBOXONE)
  119. #if (IL2CPP_SUPPORT_THREADS && (!IL2CPP_THREADS_STD && !IL2CPP_THREADS_PTHREAD && !IL2CPP_THREADS_WIN32 && !IL2CPP_THREADS_XBOXONE && !IL2CPP_THREADS_N3DS && !IL2CPP_THREADS_PS4 && !IL2CPP_THREADS_PSP2 && !IL2CPP_THREADS_SWITCH && !IL2CPP_THREADS_CUSTOM))
  120. #error "No thread implementation defined"
  121. #endif
  122. /* Platform support to cleanup attached threads even when native threads are not exited cleanly */
  123. #define IL2CPP_HAS_NATIVE_THREAD_CLEANUP (IL2CPP_THREADS_PTHREAD || IL2CPP_THREADS_WIN32 || IL2CPP_TARGET_SWITCH)
  124. #define IL2CPP_THREAD_IMPL_HAS_COM_APARTMENTS IL2CPP_TARGET_WINDOWS
  125. #if !defined(IL2CPP_ENABLE_PLATFORM_THREAD_STACKSIZE) && IL2CPP_TARGET_IOS
  126. #define IL2CPP_ENABLE_PLATFORM_THREAD_STACKSIZE 1
  127. #endif
  128. #if IL2CPP_TINY
  129. #if IL2CPP_TINY_DEBUG_METADATA || IL2CPP_TINY_DEBUGGER
  130. #define IL2CPP_ENABLE_STACKTRACES 1
  131. #else
  132. #define IL2CPP_ENABLE_STACKTRACES 0
  133. #endif // IL2CPP_TINY_DEBUG_METADATA
  134. #else
  135. #define IL2CPP_ENABLE_STACKTRACES 1
  136. #endif // IL2CPP_TINY
  137. #ifndef IL2CPP_DISABLE_GC
  138. #if IL2CPP_TINY && IL2CPP_TARGET_JAVASCRIPT
  139. #define IL2CPP_DISABLE_GC 1
  140. #endif
  141. #endif
  142. #ifndef FORCE_PINVOKE_INTERNAL
  143. #if IL2CPP_TINY && IL2CPP_TARGET_IOS
  144. #define FORCE_PINVOKE_INTERNAL 1
  145. #endif
  146. #endif
  147. #ifndef HOST_WASM
  148. #if IL2CPP_TINY_DEBUGGER && IL2CPP_TARGET_JAVASCRIPT
  149. #define HOST_WASM 1
  150. #endif
  151. #endif
  152. /* Platforms which use OS specific implementation to extract stracktrace */
  153. #if !defined(IL2CPP_ENABLE_NATIVE_STACKTRACES)
  154. #define IL2CPP_ENABLE_NATIVE_STACKTRACES (IL2CPP_TARGET_WINDOWS || IL2CPP_TARGET_LINUX || IL2CPP_TARGET_DARWIN || IL2CPP_TARGET_IOS || IL2CPP_TARGET_ANDROID || IL2CPP_TARGET_OPENHARMONY || IL2CPP_TARGET_QNX)
  155. #endif
  156. /* Platforms which support native IP emission to crash reporting to enable server-side reconstruction of C# exception stack trace line numbers */
  157. #if !defined(IL2CPP_ENABLE_NATIVE_INSTRUCTION_POINTER_EMISSION)
  158. #define IL2CPP_ENABLE_NATIVE_INSTRUCTION_POINTER_EMISSION (IL2CPP_TARGET_WINDOWS || IL2CPP_TARGET_LINUX || IL2CPP_TARGET_DARWIN || IL2CPP_TARGET_IOS || IL2CPP_TARGET_ANDROID || IL2CPP_TARGET_OPENHARMONY)
  159. #endif
  160. #if IL2CPP_ENABLE_STACKTRACES
  161. /* Platforms which use stacktrace sentries */
  162. #if !defined(IL2CPP_ENABLE_STACKTRACE_SENTRIES)
  163. #define IL2CPP_ENABLE_STACKTRACE_SENTRIES (IL2CPP_TARGET_JAVASCRIPT || IL2CPP_TARGET_N3DS || IL2CPP_TARGET_SWITCH)
  164. #endif
  165. #endif // IL2CPP_ENABLE_STACKTRACES
  166. #if (IL2CPP_ENABLE_STACKTRACES && !IL2CPP_ENABLE_NATIVE_STACKTRACES && !IL2CPP_ENABLE_STACKTRACE_SENTRIES)
  167. #error "If stacktraces are supported, then either native stack traces must be supported, or usage of stacktrace sentries must be enabled!"
  168. #endif
  169. #if (IL2CPP_ENABLE_NATIVE_STACKTRACES + IL2CPP_ENABLE_STACKTRACE_SENTRIES) > 1
  170. #error "Only one type of stacktraces are allowed"
  171. #endif
  172. #define IL2CPP_CAN_USE_MULTIPLE_SYMBOL_MAPS IL2CPP_TARGET_IOS
  173. /* GC defines*/
  174. #define IL2CPP_GC_BOEHM 1
  175. #define IL2CPP_GC_NULL !IL2CPP_GC_BOEHM
  176. #define IL2CPP_ENABLE_DEFERRED_GC IL2CPP_TARGET_JAVASCRIPT
  177. /* we always need to NULL pointer free memory with our current allocators */
  178. #define NEED_TO_ZERO_PTRFREE 1
  179. #define IL2CPP_HAS_GC_DESCRIPTORS 1
  180. #if defined(_MSC_VER)
  181. #define IL2CPP_ZERO_LEN_ARRAY 0
  182. #else
  183. #define IL2CPP_ZERO_LEN_ARRAY 0
  184. #endif
  185. #if defined(_MSC_VER)
  186. #define IL2CPP_HAS_CXX_CONSTEXPR (_MSC_VER >= 1900)
  187. #else
  188. #define IL2CPP_HAS_CXX_CONSTEXPR (__has_feature (cxx_constexpr))
  189. #endif
  190. #if IL2CPP_HAS_CXX_CONSTEXPR
  191. #define COMPILE_TIME_CONST constexpr
  192. #else
  193. #define COMPILE_TIME_CONST const
  194. #endif
  195. /* clang specific __has_builtin check */
  196. #ifndef __has_builtin
  197. #define __has_builtin(x) 0 // Compatibility with non-clang compilers.
  198. #endif
  199. #if _MSC_VER
  200. #define IL2CPP_UNREACHABLE __assume(0)
  201. #elif __has_builtin(__builtin_unreachable) || IL2CPP_TARGET_QNX
  202. #define IL2CPP_UNREACHABLE __builtin_unreachable()
  203. #else
  204. #define IL2CPP_UNREACHABLE
  205. #endif
  206. typedef uint16_t Il2CppMethodSlot;
  207. static const uint16_t kInvalidIl2CppMethodSlot = 65535;
  208. /* Debug macros */
  209. #if defined(_MSC_VER) && _MSC_VER >= 1900 // UTF-8 literals are only supported in VS2015+
  210. // On MSVC, __FILE__ will expand to ANSI string literal and will fail to compile if there are unicode characters in the path
  211. // So we specify it to be UTF-8 literal explicitly
  212. #define MAKE_UTF8_LITERAL_HELPER(x) u8 ## x
  213. #define MAKE_UTF8_LITERAL(x) MAKE_UTF8_LITERAL_HELPER(x)
  214. #else
  215. #define MAKE_UTF8_LITERAL(x) x
  216. #endif
  217. #define __FILE_UTF8__ MAKE_UTF8_LITERAL(__FILE__)
  218. #define STRINGIZE(L) #L
  219. #define MAKE_STRING(M, L) M(L)
  220. #define $Line MAKE_STRING( STRINGIZE, __LINE__ )
  221. #define FIXME "FIXME: "
  222. #define ICALLMESSAGE(name) __FILE_UTF8__ "(" $Line ") : FIXME: Missing internal call implementation: " name
  223. #define RUNTIMEMESSAGE(name) __FILE_UTF8__ "(" $Line ") : FIXME: Missing runtime implementation: " name
  224. #define NOTSUPPORTEDICALLMESSAGE(target, name, reason) __FILE_UTF8__ "(" $Line ") : Unsupported internal call for " target ":" name " - " reason
  225. // Keeping this for future usage if needed.
  226. //#if defined(_MSC_VER)
  227. // #define PRAGMA_MESSAGE(value) __pragma(message(value))
  228. //#else
  229. // #define PRAGMA_MESSAGE(value) _Pragma(STRINGIZE(value))
  230. //#endif
  231. #define PRAGMA_MESSAGE(value)
  232. #if !defined(__EMSCRIPTEN__)
  233. #define IL2CPP_NOT_IMPLEMENTED_ICALL(func) \
  234. PRAGMA_MESSAGE(ICALLMESSAGE(#func)) \
  235. IL2CPP_ASSERT(0 && #func)
  236. #define IL2CPP_NOT_IMPLEMENTED_ICALL_NO_ASSERT(func, reason) \
  237. PRAGMA_MESSAGE(ICALLMESSAGE(#func))
  238. #define IL2CPP_NOT_IMPLEMENTED(func) \
  239. PRAGMA_MESSAGE(RUNTIMEMESSAGE(#func)) \
  240. IL2CPP_ASSERT(0 && #func)
  241. #define IL2CPP_NOT_IMPLEMENTED_NO_ASSERT(func, reason) \
  242. PRAGMA_MESSAGE(RUNTIMEMESSAGE(#func))
  243. #else
  244. #include <stdio.h>
  245. #include <emscripten/emscripten.h>
  246. // emscripten's assert will throw an exception in js.
  247. // For now, we don't want that, so just printf and move on.
  248. #define IL2CPP_NOT_IMPLEMENTED_ICALL(func) \
  249. PRAGMA_MESSAGE(message(ICALLMESSAGE(#func))) \
  250. emscripten_log(EM_LOG_NO_PATHS | EM_LOG_CONSOLE | EM_LOG_ERROR | EM_LOG_JS_STACK, "Not implemented icall: %s\n", #func);
  251. #define IL2CPP_NOT_IMPLEMENTED_ICALL_NO_ASSERT(func, reason) \
  252. PRAGMA_MESSAGE(message(ICALLMESSAGE(#func)))
  253. #define IL2CPP_NOT_IMPLEMENTED(func) \
  254. PRAGMA_MESSAGE(message(RUNTIMEMESSAGE(#func))) \
  255. printf("Not implemented: %s\n", #func);
  256. #define IL2CPP_NOT_IMPLEMENTED_NO_ASSERT(func, reason) \
  257. PRAGMA_MESSAGE(message(RUNTIMEMESSAGE(#func)))
  258. #endif
  259. #if !RUNTIME_TINY
  260. #define NOT_SUPPORTED_IL2CPP(func, reason) \
  261. il2cpp::vm::Exception::Raise (il2cpp::vm::Exception::GetNotSupportedException ( NOTSUPPORTEDICALLMESSAGE ("IL2CPP", #func, #reason) ))
  262. #define NOT_SUPPORTED_SRE(func) \
  263. il2cpp::vm::Exception::Raise (il2cpp::vm::Exception::GetNotSupportedException ( NOTSUPPORTEDICALLMESSAGE ("IL2CPP", #func, "System.Reflection.Emit is not supported.") ))
  264. #define NOT_SUPPORTED_REMOTING(func) \
  265. il2cpp::vm::Exception::Raise (il2cpp::vm::Exception::GetNotSupportedException ( NOTSUPPORTEDICALLMESSAGE ("IL2CPP", #func, "System.Runtime.Remoting is not supported.") ))
  266. #if IL2CPP_TARGET_JAVASCRIPT
  267. #define NOT_SUPPORTED_WEBGL(func, reason) \
  268. il2cpp::vm::Exception::Raise (il2cpp::vm::Exception::GetNotSupportedException ( NOTSUPPORTEDICALLMESSAGE ("WebGL", #func, #reason) ))
  269. #else
  270. #define NOT_SUPPORTED_WEBGL(func, reason)
  271. #endif
  272. #else
  273. #define NOT_SUPPORTED_IL2CPP(func, reason)
  274. #define NOT_SUPPORTED_SRE(func)
  275. #define NOT_SUPPORTED_REMOTING(func)
  276. #define NOT_SUPPORTED_WEBGL(func, reason)
  277. #endif // #if !RUNTIME_TINY
  278. #if IL2CPP_COMPILER_MSVC
  279. #define IL2CPP_DIR_SEPARATOR '\\' /* backslash */
  280. #else
  281. #define IL2CPP_DIR_SEPARATOR '/' /* forward slash */
  282. #endif
  283. #ifndef IL2CPP_DISABLE_FULL_MESSAGES
  284. #define IL2CPP_DISABLE_FULL_MESSAGES 1
  285. #endif
  286. #if IL2CPP_COMPILER_MSVC
  287. #define IL2CPP_USE_GENERIC_SOCKET_IMPL 0
  288. #else
  289. #define IL2CPP_USE_GENERIC_SOCKET_IMPL !(IL2CPP_TARGET_POSIX || IL2CPP_TARGET_SWITCH || IL2CPP_SUPPORT_SOCKETS_POSIX_API)
  290. #endif
  291. #ifndef IL2CPP_USE_GENERIC_SOCKET_BRIDGE
  292. #define IL2CPP_USE_GENERIC_SOCKET_BRIDGE !IL2CPP_TARGET_JAVASCRIPT
  293. #endif
  294. /* Set by platforms that require special handling of SIGPIPE signalling during socket sends. */
  295. /* Is redefined by platform specific headers. Enabled for common Linux desktop platforms. */
  296. #ifndef IL2CPP_USE_SEND_NOSIGNAL
  297. #define IL2CPP_USE_SEND_NOSIGNAL IL2CPP_TARGET_LINUX
  298. #endif
  299. #ifndef IL2CPP_USE_GENERIC_ENVIRONMENT
  300. #define IL2CPP_USE_GENERIC_ENVIRONMENT (!IL2CPP_TARGET_WINDOWS && !IL2CPP_TARGET_POSIX)
  301. #endif
  302. #define IL2CPP_USE_GENERIC_COM (!IL2CPP_TARGET_WINDOWS || IL2CPP_TARGET_WINDOWS_GAMES)
  303. #define IL2CPP_USE_GENERIC_COM_SAFEARRAYS (!IL2CPP_TARGET_WINDOWS || IL2CPP_TARGET_XBOXONE || IL2CPP_TARGET_WINDOWS_GAMES)
  304. #define IL2CPP_USE_GENERIC_WINDOWSRUNTIME (!IL2CPP_TARGET_WINDOWS || RUNTIME_NONE || IL2CPP_TINY || IL2CPP_TARGET_WINDOWS_GAMES)
  305. #ifndef IL2CPP_USE_GENERIC_MEMORY_MAPPED_FILE
  306. #define IL2CPP_USE_GENERIC_MEMORY_MAPPED_FILE (IL2CPP_TARGET_XBOXONE || IL2CPP_TARGET_WINDOWS_GAMES || IL2CPP_TARGET_JAVASCRIPT || (!IL2CPP_TARGET_WINDOWS && !IL2CPP_TARGET_POSIX))
  307. #endif
  308. #ifndef IL2CPP_HAS_CLOSE_EXEC
  309. #define IL2CPP_HAS_CLOSE_EXEC (IL2CPP_TARGET_POSIX && !IL2CPP_TARGET_PS4)
  310. #endif
  311. #ifndef IL2CPP_HAS_DUP
  312. #define IL2CPP_HAS_DUP (IL2CPP_TARGET_POSIX && !IL2CPP_TARGET_PS4)
  313. #endif
  314. #ifndef IL2CPP_USE_GENERIC_FILE
  315. #define IL2CPP_USE_GENERIC_FILE (!IL2CPP_TARGET_WINDOWS && !IL2CPP_TARGET_DARWIN)
  316. #endif
  317. #ifndef IL2CPP_USE_GENERIC_DEBUG_LOG
  318. #define IL2CPP_USE_GENERIC_DEBUG_LOG !IL2CPP_TARGET_WINDOWS
  319. #endif
  320. #ifndef IL2CPP_USE_GENERIC_PROCESS
  321. #define IL2CPP_USE_GENERIC_PROCESS 1
  322. #endif
  323. #ifndef IL2CPP_USE_GENERIC_THREAD
  324. #define IL2CPP_USE_GENERIC_THREAD (!IL2CPP_TARGET_WINDOWS && !IL2CPP_TARGET_POSIX && !IL2CPP_TARGET_DARWIN)
  325. #endif
  326. #define IL2CPP_SIZEOF_STRUCT_WITH_NO_INSTANCE_FIELDS 1
  327. #define IL2CPP_VALIDATE_FIELD_LAYOUT 0
  328. #if IL2CPP_MONO_DEBUGGER
  329. #define STORE_SEQ_POINT(storage, seqPoint) (storage).currentSequencePoint = seqPoint;
  330. #define STORE_TRY_ID(storage, id) (storage).tryId = id;
  331. #define CHECK_SEQ_POINT(storage, seqPoint) il2cpp_codegen_check_sequence_point(&(storage), seqPoint);
  332. #define CHECK_METHOD_ENTRY_SEQ_POINT(storage, seqPoint) il2cpp_codegen_check_sequence_point_entry(&(storage), seqPoint);
  333. #define CHECK_METHOD_EXIT_SEQ_POINT(name, storage, seqPoint) MethodExitSequencePointChecker name(&(storage), seqPoint);
  334. #define DECLARE_METHOD_THIS(variableName, thisAddress) void* variableName[] = { thisAddress }
  335. #define DECLARE_METHOD_PARAMS(variableName, ...) void* variableName[] = { __VA_ARGS__ }
  336. #define DECLARE_METHOD_LOCALS(variableName, ...) void* variableName[] = { __VA_ARGS__ }
  337. #define DECLARE_METHOD_EXEC_CTX(ctxVariable, method, thisVariable, paramsVariable, localsVariable) Il2CppSequencePointExecutionContext ctxVariable(method, thisVariable, paramsVariable, localsVariable)
  338. #define CHECK_PAUSE_POINT il2cpp_codegen_check_pause_point()
  339. #else
  340. #define STORE_SEQ_POINT(storage, seqPoint)
  341. #define STORE_TRY_ID(storage, id)
  342. #define CHECK_SEQ_POINT(storage, seqPoint)
  343. #define CHECK_METHOD_ENTRY_SEQ_POINT(storage, seqPoint)
  344. #define CHECK_METHOD_EXIT_SEQ_POINT(name, storage, seqPoint)
  345. #define DECLARE_METHOD_THIS(variableName, thisAddress)
  346. #define DECLARE_METHOD_PARAMS(variableName, ...)
  347. #define DECLARE_METHOD_LOCALS(variableName, ...)
  348. #define DECLARE_METHOD_EXEC_CTX(ctxVariable, method, thisVariable, paramsVariable, localsVariable)
  349. #define CHECK_PAUSE_POINT
  350. #endif
  351. #ifdef __cplusplus
  352. template<bool value>
  353. struct Il2CppStaticAssertHelper;
  354. template<>
  355. struct Il2CppStaticAssertHelper<true>
  356. {
  357. };
  358. #define Assert(x) do { (void)(x); IL2CPP_ASSERT(x); } while (false)
  359. #define Il2CppStaticAssert(...) do { Il2CppStaticAssertHelper<(__VA_ARGS__)>(); } while (false)
  360. #endif
  361. static const int32_t kIl2CppInt32Min = INT32_MIN;
  362. static const int32_t kIl2CppInt32Max = INT32_MAX;
  363. static const uint32_t kIl2CppUInt32Max = UINT32_MAX;
  364. static const int64_t kIl2CppInt64Min = INT64_MIN;
  365. static const int64_t kIl2CppInt64Max = INT64_MAX;
  366. static const uint64_t kIl2CppUInt64Max = UINT64_MAX;
  367. #if IL2CPP_SIZEOF_VOID_P == 8
  368. static const intptr_t kIl2CppIntPtrMin = INT64_MIN;
  369. static const intptr_t kIl2CppIntPtrMax = INT64_MAX;
  370. static const uintptr_t kIl2CppUIntPtrMax = UINT64_MAX;
  371. #else
  372. static const intptr_t kIl2CppIntPtrMin = INT32_MIN;
  373. static const intptr_t kIl2CppIntPtrMax = INT32_MAX;
  374. static const uintptr_t kIl2CppUIntPtrMax = UINT32_MAX;
  375. #endif
  376. static const int ipv6AddressSize = 16;
  377. #if !defined(IL2CPP_SUPPORT_IPV6)
  378. #define IL2CPP_SUPPORT_IPV6 !IL2CPP_TARGET_PS4 && !IL2CPP_TARGET_SWITCH
  379. #endif
  380. #define IL2CPP_SUPPORT_IPV6_SUPPORT_QUERY (IL2CPP_SUPPORT_IPV6 && IL2CPP_TARGET_LINUX)
  381. #if !defined(IL2CPP_SUPPORT_SEND_FILE)
  382. #define IL2CPP_SUPPORT_SEND_FILE (!IL2CPP_TARGET_SWITCH && !IL2CPP_TARGET_QNX && !IL2CPP_TARGET_JAVASCRIPT)
  383. #endif
  384. #if !defined(IL2CPP_SUPPORT_RECV_MSG)
  385. #define IL2CPP_SUPPORT_RECV_MSG (!IL2CPP_TARGET_SWITCH)
  386. #endif
  387. #if !defined(IL2CPP_SUPPORT_SEND_MSG)
  388. #define IL2CPP_SUPPORT_SEND_MSG (!IL2CPP_TARGET_SWITCH)
  389. #endif
  390. #ifndef IL2CPP_USE_NETWORK_ACCESS_HANDLER
  391. #define IL2CPP_USE_NETWORK_ACCESS_HANDLER 0
  392. #endif
  393. // Android: "There is no support for locales in the C library" https://code.google.com/p/android/issues/detail?id=57313
  394. // PS4/PS2: strtol_d doesn't exist
  395. #if !defined(IL2CPP_SUPPORT_LOCALE_INDEPENDENT_PARSING)
  396. #define IL2CPP_SUPPORT_LOCALE_INDEPENDENT_PARSING (!IL2CPP_TARGET_QNX && !IL2CPP_TARGET_ANDROID &&!IL2CPP_TARGET_OPENHARMONY && !IL2CPP_TARGET_PS4 && !IL2CPP_TARGET_PSP2)
  397. #endif
  398. #define NO_UNUSED_WARNING(expr) (void)(expr)
  399. typedef int32_t il2cpp_hresult_t;
  400. // Sorted numerically!
  401. #define IL2CPP_S_OK ((il2cpp_hresult_t)0)
  402. #define IL2CPP_S_FALSE ((il2cpp_hresult_t)1)
  403. #define IL2CPP_E_BOUNDS ((il2cpp_hresult_t)0x8000000B)
  404. #define IL2CPP_E_CHANGED_STATE ((il2cpp_hresult_t)0x8000000C)
  405. #define IL2CPP_E_ILLEGAL_METHOD_CALL ((il2cpp_hresult_t)0x8000000E)
  406. #define IL2CPP_RO_E_CLOSED ((il2cpp_hresult_t)0x80000013)
  407. #define IL2CPP_E_NOTIMPL ((il2cpp_hresult_t)0x80004001)
  408. #define IL2CPP_E_NOINTERFACE ((il2cpp_hresult_t)0x80004002)
  409. #define IL2CPP_E_POINTER ((il2cpp_hresult_t)0x80004003)
  410. #define IL2CPP_E_ABORT ((il2cpp_hresult_t)0x80004004)
  411. #define IL2CPP_E_FAIL ((il2cpp_hresult_t)0x80004005)
  412. #define IL2CPP_E_UNEXPECTED ((il2cpp_hresult_t)0x8000FFFF)
  413. #define IL2CPP_RPC_E_DISCONNECTED ((il2cpp_hresult_t)0x80010108)
  414. #define IL2CPP_RPC_E_WRONG_THREAD ((il2cpp_hresult_t)0x8001010E)
  415. #define IL2CPP_DISP_E_PARAMNOTFOUND ((il2cpp_hresult_t)0x80020004)
  416. #define IL2CPP_REGDB_E_CLASSNOTREG ((il2cpp_hresult_t)0x80040154)
  417. #define IL2CPP_E_FILE_NOT_FOUND ((il2cpp_hresult_t)0x80070002)
  418. #define IL2CPP_E_ACCESS_DENIED ((il2cpp_hresult_t)0x80070005)
  419. #define IL2CPP_E_OUTOFMEMORY ((il2cpp_hresult_t)0x8007000E)
  420. #define IL2CPP_E_INVALIDARG ((il2cpp_hresult_t)0x80070057)
  421. #define IL2CPP_COR_E_EXCEPTION ((il2cpp_hresult_t)0x80131500)
  422. #define IL2CPP_COR_E_EXECUTIONENGINE ((il2cpp_hresult_t)0x80131506)
  423. #define IL2CPP_COR_E_INVALIDOPERATION ((il2cpp_hresult_t)0x80131509)
  424. #define IL2CPP_COR_E_PLATFORMNOTSUPPORTED ((il2cpp_hresult_t)0x80131539)
  425. #define IL2CPP_COR_E_OPERATIONCANCELED ((il2cpp_hresult_t)0x8013153B)
  426. #define IL2CPP_COR_E_OBJECTDISPOSED ((il2cpp_hresult_t)0x80131622)
  427. #define IL2CPP_HR_SUCCEEDED(hr) (((il2cpp_hresult_t)(hr)) >= 0)
  428. #define IL2CPP_HR_FAILED(hr) (((il2cpp_hresult_t)(hr)) < 0)
  429. #define IL2CPP_LITTLE_ENDIAN 1
  430. #define IL2CPP_BIG_ENDIAN 2
  431. #define IL2CPP_BYTE_ORDER IL2CPP_LITTLE_ENDIAN
  432. #if (defined(_MSC_VER) && _MSC_VER > 1600) || (__has_feature(cxx_override_control))
  433. #define IL2CPP_OVERRIDE override
  434. #define IL2CPP_FINAL final
  435. #else
  436. #define IL2CPP_OVERRIDE
  437. #define IL2CPP_FINAL
  438. #endif
  439. #if (__has_feature(cxx_deleted_functions) || (defined(_MSC_VER) && _MSC_VER >= 1800))
  440. #define IL2CPP_HAS_DELETED_FUNCTIONS 1
  441. #else
  442. #define IL2CPP_HAS_DELETED_FUNCTIONS 0
  443. #endif
  444. #if IL2CPP_TARGET_WINDOWS
  445. static const Il2CppChar kIl2CppNewLine[] = { '\r', '\n', '\0' };
  446. #else
  447. static const Il2CppChar kIl2CppNewLine[] = { '\n', '\0' };
  448. #endif
  449. #define MAXIMUM_NESTED_GENERICS_EXCEPTION_MESSAGE "IL2CPP encountered a managed type which it cannot convert ahead-of-time. The type uses generic or array types which are nested beyond the maximum depth which can be converted. Consider increasing the --maximum-recursive-generic-depth=%d argument"
  450. #if IL2CPP_COMPILER_MSVC
  451. #define IL2CPP_ATTRIBUTE_WEAK
  452. #else
  453. #define IL2CPP_ATTRIBUTE_WEAK __attribute__((weak))
  454. #endif
  455. #if IL2CPP_TARGET_XBOXONE || IL2CPP_TARGET_WINRT || IL2CPP_TARGET_ANDROID || IL2CPP_TARGET_OPENHARMONY || IL2CPP_TARGET_PS4 || IL2CPP_TARGET_PSP2
  456. #define IL2CPP_USE_GENERIC_CPU_INFO 1
  457. #else
  458. #define IL2CPP_USE_GENERIC_CPU_INFO 0
  459. #endif
  460. #if !defined(IL2CPP_CAN_CHECK_EXECUTABLE)
  461. #define IL2CPP_CAN_CHECK_EXECUTABLE IL2CPP_TARGET_WINDOWS || (IL2CPP_TARGET_POSIX && !IL2CPP_TARGET_PS4)
  462. #endif
  463. #if IL2CPP_MONO_DEBUGGER
  464. #define IL2CPP_DEBUG_BREAK() il2cpp::utils::Debugger::UserBreak()
  465. #else
  466. #ifdef _MSC_VER
  467. #define IL2CPP_DEBUG_BREAK() __debugbreak()
  468. #else
  469. #define IL2CPP_DEBUG_BREAK()
  470. #endif
  471. #endif
  472. #if defined(__cplusplus)
  473. template<typename Type, size_t Size>
  474. char(*il2cpp_array_size_helper(Type(&array)[Size]))[Size];
  475. #define IL2CPP_ARRAY_SIZE(array) (sizeof(*il2cpp_array_size_helper(array)))
  476. #endif // __cplusplus
  477. #ifndef IL2CPP_MUTATE_METHOD_POINTERS
  478. #define IL2CPP_MUTATE_METHOD_POINTERS !IL2CPP_TARGET_PS4
  479. #endif
  480. #define IL2CPP_USE_GENERIC_ASSERT !(IL2CPP_TARGET_WINDOWS || IL2CPP_TARGET_XBOXONE || IL2CPP_TARGET_WINRT || IL2CPP_TARGET_PS4 || IL2CPP_TARGET_PS5)
  481. #ifndef IL2CPP_USE_SPARSEHASH
  482. #define IL2CPP_USE_SPARSEHASH ((IL2CPP_TARGET_ANDROID && !ENABLE_HMI_MODE) || IL2CPP_TARGET_OPENHARMONY || IL2CPP_TARGET_IOS)
  483. #endif
  484. #ifndef IL2CPP_ENABLE_LAZY_INIT
  485. #define IL2CPP_ENABLE_LAZY_INIT (((IL2CPP_TARGET_JAVASCRIPT && PLATFORM_WEIXINMINIGAME) || ENABLE_HMI_MODE) && !IL2CPP_MONO_DEBUGGER)
  486. #endif
  487. #ifndef IL2CPP_SLIM_CLASS
  488. #define IL2CPP_SLIM_CLASS (IL2CPP_TARGET_JAVASCRIPT && PLATFORM_WEIXINMINIGAME && !IL2CPP_MONO_DEBUGGER)
  489. #endif
  490. // remove COM/winRT related stuff to slim the minigame platform
  491. #ifndef IL2CPP_TRIM_COM
  492. #define IL2CPP_TRIM_COM (IL2CPP_TARGET_JAVASCRIPT && PLATFORM_WEIXINMINIGAME)
  493. #endif
  494. #ifndef IL2CPP_ENABLE_MEM_STATS
  495. #define IL2CPP_ENABLE_MEM_STATS 0
  496. #endif
  497. //defined by buildprogram
  498. //#define SLIM_GLOBAL_METADATA_FILE 1
  499. #if !IL2CPP_DEBUG
  500. #define IL2CPP_ASSERT(expr) void(0)
  501. #else
  502. #if defined(__cplusplus)
  503. #define IL2CPP_ASSERT(expr) (static_cast<bool>(expr) ? void(0) : il2cpp_assert(#expr, __FILE__, __LINE__))
  504. #else
  505. #define IL2CPP_ASSERT(expr) (expr) ? void(0) : il2cpp_assert(#expr, __FILE__, __LINE__))
  506. #endif
  507. extern void il2cpp_assert(const char* assertion, const char* file, unsigned int line);
  508. #endif
  509. #if !defined(IL2CPP_SUPPORTS_BROKERED_FILESYSTEM)
  510. #define IL2CPP_SUPPORTS_BROKERED_FILESYSTEM IL2CPP_TARGET_WINRT
  511. #endif