il2cpp-config.h 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457
  1. #pragma once
  2. #include <assert.h>
  3. #include <stddef.h>
  4. #include <stdlib.h>
  5. #include <stdio.h>
  6. #include <string.h>
  7. #include <stdint.h>
  8. /* first setup platform defines*/
  9. #include "os/c-api/il2cpp-config-platforms.h"
  10. #define IL2CPP_COMPILER_MSVC (IL2CPP_TARGET_WINDOWS || IL2CPP_TARGET_XBOXONE)
  11. #ifndef IL2CPP_EXCEPTION_DISABLED
  12. #define IL2CPP_EXCEPTION_DISABLED 0
  13. #endif
  14. // If the platform loads il2cpp as a dynamic library but does not have dlsym (or equivalent) then
  15. // define IL2CPP_API_DYNAMIC_NO_DLSYM = 1 to add support for api function registration and symbol
  16. // lookup APIs, see il2cpp-api.cpp
  17. #ifndef IL2CPP_API_DYNAMIC_NO_DLSYM
  18. #define IL2CPP_API_DYNAMIC_NO_DLSYM 0
  19. #endif
  20. #ifdef _MSC_VER
  21. # include <malloc.h>
  22. # define IL2CPP_EXPORT __declspec(dllexport)
  23. # define IL2CPP_IMPORT __declspec(dllimport)
  24. #elif IL2CPP_TARGET_PSP2 || IL2CPP_TARGET_PS4
  25. # define IL2CPP_EXPORT __declspec(dllexport)
  26. # define IL2CPP_IMPORT __declspec(dllimport)
  27. #else
  28. # define IL2CPP_EXPORT __attribute__ ((visibility ("default")))
  29. # define IL2CPP_IMPORT
  30. #endif
  31. #ifdef LIBIL2CPP_EXPORT_CODEGEN_API
  32. # define LIBIL2CPP_CODEGEN_API IL2CPP_EXPORT
  33. #elif LIBIL2CPP_IMPORT_CODEGEN_API
  34. # define LIBIL2CPP_CODEGEN_API IL2CPP_IMPORT
  35. #else
  36. # define LIBIL2CPP_CODEGEN_API
  37. #endif
  38. #if defined(__ARMCC_VERSION)
  39. #include <assert.h>
  40. #include <wchar.h>
  41. #include <ctype.h>
  42. #define INTPTR_MAX 2147483647
  43. #endif
  44. #ifndef IL2CPP_METHOD_ATTR
  45. #define IL2CPP_METHOD_ATTR
  46. #endif
  47. #if defined(_MSC_VER)
  48. #define IL2CPP_CXX_ABI_MSVC 1
  49. #else
  50. #define IL2CPP_CXX_ABI_MSVC 0
  51. #endif
  52. #if IL2CPP_COMPILER_MSVC
  53. #ifndef STDCALL
  54. #define STDCALL __stdcall
  55. #endif STDCALL
  56. #ifndef CDECL
  57. #define CDECL __cdecl
  58. #endif
  59. #else
  60. #define STDCALL
  61. #define CDECL
  62. #endif
  63. #if IL2CPP_COMPILER_MSVC || defined(__ARMCC_VERSION)
  64. #define NORETURN __declspec(noreturn)
  65. #else
  66. #define NORETURN
  67. #endif
  68. #if IL2CPP_TARGET_IOS || IL2CPP_TARGET_ANDROID || IL2CPP_TARGET_DARWIN
  69. #define REAL_NORETURN __attribute__ ((noreturn))
  70. #else
  71. #define REAL_NORETURN NORETURN
  72. #endif
  73. #if IL2CPP_COMPILER_MSVC || defined(__ARMCC_VERSION)
  74. #define IL2CPP_NO_INLINE __declspec(noinline)
  75. #else
  76. #define IL2CPP_NO_INLINE __attribute__ ((noinline))
  77. #endif
  78. #if IL2CPP_COMPILER_MSVC
  79. #define NOVTABLE __declspec(novtable)
  80. #else
  81. #define NOVTABLE
  82. #endif
  83. #define IL2CPP_ENABLE_MONO_BUG_EMULATION 1
  84. // We currently use ALIGN_TYPE just for types decorated with IL2CPPStructAlignment, as it's needed for WebGL to properly align UnityEngine.Color.
  85. // On MSVC, it causes build issues on x86 since you cannot pass aligned type by value as an argument to a function:
  86. // error C2719: 'value': formal parameter with requested alignment of 16 won't be aligned
  87. // Since this isn't actually needed for Windows, and it's not a standard .NET feature but just IL2CPP extension, let's just turn it off on Windows
  88. #if defined(__GNUC__) || defined(__SNC__) || defined(__clang__)
  89. #define ALIGN_OF(T) __alignof__(T)
  90. #define ALIGN_TYPE(val) __attribute__((aligned(val)))
  91. #define ALIGN_FIELD(val) ALIGN_TYPE(val)
  92. #define FORCE_INLINE inline __attribute__ ((always_inline))
  93. #elif defined(_MSC_VER)
  94. #define ALIGN_OF(T) __alignof(T)
  95. #define ALIGN_TYPE(val)
  96. #define ALIGN_FIELD(val) __declspec(align(val))
  97. #define FORCE_INLINE __forceinline
  98. #else
  99. #define ALIGN_TYPE(size)
  100. #define ALIGN_FIELD(size)
  101. #define FORCE_INLINE inline
  102. #endif
  103. #define IL2CPP_PAGE_SIZE 4096
  104. // 64-bit types are aligned to 8 bytes on 64-bit platforms and always on Windows
  105. #define IL2CPP_ENABLE_INTERLOCKED_64_REQUIRED_ALIGNMENT ((IL2CPP_SIZEOF_VOID_P == 8) || (IL2CPP_TARGET_WINDOWS))
  106. /* Debugging */
  107. #ifndef IL2CPP_DEBUG
  108. #define IL2CPP_DEBUG 0
  109. #endif
  110. #ifndef IL2CPP_DEVELOPMENT
  111. #define IL2CPP_DEVELOPMENT 0
  112. #endif
  113. #define IL2CPP_USE_STD_THREAD 0
  114. #define IL2CPP_THREADS_STD IL2CPP_USE_STD_THREAD
  115. #define IL2CPP_THREADS_PTHREAD (!IL2CPP_THREADS_STD && IL2CPP_TARGET_POSIX)
  116. #define IL2CPP_THREADS_WIN32 (!IL2CPP_THREADS_STD && IL2CPP_TARGET_WINDOWS)
  117. #define IL2CPP_THREADS_N3DS (!IL2CPP_THREADS_STD && IL2CPP_TARGET_N3DS)
  118. #define IL2CPP_THREADS_PS4 (!IL2CPP_THREADS_STD && IL2CPP_TARGET_PS4)
  119. #define IL2CPP_THREADS_PSP2 (!IL2CPP_THREADS_STD && IL2CPP_TARGET_PSP2)
  120. #define IL2CPP_THREADS_SWITCH (!IL2CPP_THREADS_STD && IL2CPP_TARGET_SWITCH)
  121. #define IL2CPP_THREADS_ALL_ACCESS (!IL2CPP_THREADS_STD && IL2CPP_TARGET_XBOXONE)
  122. #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))
  123. #error "No thread implementation defined"
  124. #endif
  125. /* Platform support to cleanup attached threads even when native threads are not exited cleanly */
  126. #define IL2CPP_HAS_NATIVE_THREAD_CLEANUP (IL2CPP_THREADS_PTHREAD || IL2CPP_THREADS_WIN32)
  127. #define IL2CPP_THREAD_IMPL_HAS_COM_APARTMENTS IL2CPP_TARGET_WINDOWS
  128. #if !defined(IL2CPP_ENABLE_PLATFORM_THREAD_STACKSIZE) && IL2CPP_TARGET_IOS
  129. #define IL2CPP_ENABLE_PLATFORM_THREAD_STACKSIZE 1
  130. #endif
  131. #define IL2CPP_ENABLE_STACKTRACES 1
  132. /* Platforms which use OS specific implementation to extract stracktrace */
  133. #if !defined(IL2CPP_ENABLE_NATIVE_STACKTRACES)
  134. #define IL2CPP_ENABLE_NATIVE_STACKTRACES (IL2CPP_TARGET_WINDOWS || IL2CPP_TARGET_LINUX || IL2CPP_TARGET_DARWIN || IL2CPP_TARGET_IOS || IL2CPP_TARGET_TIZEN || IL2CPP_TARGET_ANDROID)
  135. #endif
  136. /* Platforms which use stacktrace sentries */
  137. #define IL2CPP_ENABLE_STACKTRACE_SENTRIES (IL2CPP_TARGET_JAVASCRIPT || IL2CPP_TARGET_N3DS || IL2CPP_TARGET_SWITCH)
  138. #if (IL2CPP_ENABLE_STACKTRACES && !IL2CPP_ENABLE_NATIVE_STACKTRACES && !IL2CPP_ENABLE_STACKTRACE_SENTRIES)
  139. #error "If stacktraces are supported, then either native stack traces must be supported, or usage of stacktrace sentries must be enabled!"
  140. #endif
  141. #if (IL2CPP_ENABLE_NATIVE_STACKTRACES + IL2CPP_ENABLE_STACKTRACE_SENTRIES) > 1
  142. #error "Only one type of stacktraces are allowed"
  143. #endif
  144. #define IL2CPP_CAN_USE_MULTIPLE_SYMBOL_MAPS IL2CPP_TARGET_IOS
  145. /* Profiler */
  146. #ifndef IL2CPP_ENABLE_PROFILER
  147. #define IL2CPP_ENABLE_PROFILER 1
  148. #endif
  149. /* GC defines*/
  150. #define IL2CPP_GC_BOEHM 1
  151. #define IL2CPP_GC_NULL !IL2CPP_GC_BOEHM
  152. #define IL2CPP_ENABLE_DEFERRED_GC IL2CPP_TARGET_JAVASCRIPT
  153. /* we always need to NULL pointer free memory with our current allocators */
  154. #define NEED_TO_ZERO_PTRFREE 1
  155. #define IL2CPP_HAS_GC_DESCRIPTORS 1
  156. #if defined(_MSC_VER)
  157. #define IL2CPP_ZERO_LEN_ARRAY 0
  158. #else
  159. #define IL2CPP_ZERO_LEN_ARRAY 0
  160. #endif
  161. #if defined(_MSC_VER)
  162. #define IL2CPP_HAS_CXX_CONSTEXPR (_MSC_VER >= 1900)
  163. #else
  164. #define IL2CPP_HAS_CXX_CONSTEXPR (__has_feature (cxx_constexpr))
  165. #endif
  166. /* clang specific __has_builtin check */
  167. #ifndef __has_builtin
  168. #define __has_builtin(x) 0 // Compatibility with non-clang compilers.
  169. #endif
  170. #if _MSC_VER
  171. #define IL2CPP_UNREACHABLE __assume(0)
  172. #elif __has_builtin(__builtin_unreachable)
  173. #define IL2CPP_UNREACHABLE __builtin_unreachable()
  174. #else
  175. #define IL2CPP_UNREACHABLE
  176. #endif
  177. typedef uint32_t Il2CppMethodSlot;
  178. const uint32_t kInvalidIl2CppMethodSlot = 65535;
  179. /* Debug macros */
  180. #define STRINGIZE(L) #L
  181. #define MAKE_STRING(M, L) M(L)
  182. #define $Line MAKE_STRING( STRINGIZE, __LINE__ )
  183. #define FIXME __FILE__ "(" $Line ") : FIXME: "
  184. #define ICALLMESSAGE(name) __FILE__ "(" $Line ") : FIXME: Missing internal call implementation: " name
  185. #define RUNTIMEMESSAGE(name) __FILE__ "(" $Line ") : FIXME: Missing runtime implementation: " name
  186. #define NOTSUPPORTEDICALLMESSAGE(target, name, reason) __FILE__ "(" $Line ") : Unsupported internal call for " target ":" name " - " reason
  187. // Keeping this for future usage if needed.
  188. //#if defined(_MSC_VER)
  189. // #define PRAGMA_MESSAGE(value) __pragma(message(value))
  190. //#else
  191. // #define PRAGMA_MESSAGE(value) _Pragma(STRINGIZE(value))
  192. //#endif
  193. #define PRAGMA_MESSAGE(value)
  194. #if !defined(EMSCRIPTEN)
  195. #define NOT_IMPLEMENTED_ICALL(func) \
  196. PRAGMA_MESSAGE(ICALLMESSAGE(#func)) \
  197. IL2CPP_ASSERT(0 && #func)
  198. #define NOT_IMPLEMENTED_ICALL_NO_ASSERT(func, reason) \
  199. PRAGMA_MESSAGE(ICALLMESSAGE(#func))
  200. #define NOT_IMPLEMENTED(func) \
  201. PRAGMA_MESSAGE(RUNTIMEMESSAGE(#func)) \
  202. IL2CPP_ASSERT(0 && #func)
  203. #define NOT_IMPLEMENTED_NO_ASSERT(func, reason) \
  204. PRAGMA_MESSAGE(RUNTIMEMESSAGE(#func))
  205. #else
  206. // emscripten's assert will throw an exception in js.
  207. // For now, we don't want that, so just printf and move on.
  208. #define NOT_IMPLEMENTED_ICALL(func) \
  209. PRAGMA_MESSAGE(message(ICALLMESSAGE(#func))) \
  210. printf("Not implemented icall: %s\n", #func);
  211. #define NOT_IMPLEMENTED_ICALL_NO_ASSERT(func, reason) \
  212. PRAGMA_MESSAGE(message(ICALLMESSAGE(#func)))
  213. #define NOT_IMPLEMENTED(func) \
  214. PRAGMA_MESSAGE(message(RUNTIMEMESSAGE(#func))) \
  215. printf("Not implemented: %s\n", #func);
  216. #define NOT_IMPLEMENTED_NO_ASSERT(func, reason) \
  217. PRAGMA_MESSAGE(message(RUNTIMEMESSAGE(#func)))
  218. #endif
  219. #define NOT_SUPPORTED_IL2CPP(func, reason) \
  220. il2cpp::vm::Exception::Raise (il2cpp::vm::Exception::GetNotSupportedException ( NOTSUPPORTEDICALLMESSAGE ("IL2CPP", #func, #reason) ))
  221. #define NOT_SUPPORTED_SRE(func) \
  222. il2cpp::vm::Exception::Raise (il2cpp::vm::Exception::GetNotSupportedException ( NOTSUPPORTEDICALLMESSAGE ("IL2CPP", #func, "System.Reflection.Emit is not supported.") ))
  223. #define NOT_SUPPORTED_REMOTING(func) \
  224. il2cpp::vm::Exception::Raise (il2cpp::vm::Exception::GetNotSupportedException ( NOTSUPPORTEDICALLMESSAGE ("IL2CPP", #func, "System.Runtime.Remoting is not supported.") ))
  225. #if IL2CPP_TARGET_JAVASCRIPT
  226. #define NOT_SUPPORTED_WEBGL(func, reason) \
  227. il2cpp::vm::Exception::Raise (il2cpp::vm::Exception::GetNotSupportedException ( NOTSUPPORTEDICALLMESSAGE ("WebGL", #func, #reason) ))
  228. #else
  229. #define NOT_SUPPORTED_WEBGL(func, reason)
  230. #endif
  231. #if IL2CPP_COMPILER_MSVC
  232. #define IL2CPP_DIR_SEPARATOR '\\' /* backslash */
  233. #else
  234. #define IL2CPP_DIR_SEPARATOR '/' /* forward slash */
  235. #endif
  236. #ifndef IL2CPP_DISABLE_FULL_MESSAGES
  237. #define IL2CPP_DISABLE_FULL_MESSAGES 1
  238. #endif
  239. #if IL2CPP_COMPILER_MSVC
  240. #define IL2CPP_USE_GENERIC_SOCKET_IMPL 0
  241. #else
  242. #define IL2CPP_USE_GENERIC_SOCKET_IMPL (!IL2CPP_TARGET_POSIX || IL2CPP_TARGET_JAVASCRIPT) && (!IL2CPP_TARGET_SWITCH)
  243. #endif
  244. /* set by platforms that require special handling of SIGPIPE signalling during socket sends */
  245. #ifndef IL2CPP_USE_SEND_NOSIGNAL
  246. #define IL2CPP_USE_SEND_NOSIGNAL 0
  247. #endif
  248. #define IL2CPP_USE_GENERIC_ENVIRONMENT (!IL2CPP_TARGET_WINDOWS && !IL2CPP_TARGET_POSIX)
  249. #define IL2CPP_USE_GENERIC_COM (!IL2CPP_TARGET_WINDOWS)
  250. #define IL2CPP_USE_GENERIC_COM_SAFEARRAYS (!IL2CPP_TARGET_WINDOWS || IL2CPP_TARGET_XBOXONE)
  251. #define IL2CPP_USE_GENERIC_WINDOWSRUNTIME (!IL2CPP_TARGET_WINDOWS || RUNTIME_MONO || RUNTIME_NONE)
  252. #ifndef IL2CPP_USE_GENERIC_MEMORY_MAPPED_FILE
  253. #define IL2CPP_USE_GENERIC_MEMORY_MAPPED_FILE (IL2CPP_TARGET_XBOXONE || (!IL2CPP_TARGET_WINDOWS && !IL2CPP_TARGET_POSIX))
  254. #endif
  255. #ifndef IL2CPP_USE_GENERIC_FILE
  256. #define IL2CPP_USE_GENERIC_FILE (!IL2CPP_TARGET_WINDOWS && !IL2CPP_TARGET_DARWIN)
  257. #endif
  258. #define IL2CPP_SIZEOF_STRUCT_WITH_NO_INSTANCE_FIELDS 1
  259. #define IL2CPP_VALIDATE_FIELD_LAYOUT 0
  260. #if IL2CPP_COMPILER_MSVC // Use stub "return false" implementation where it's not implemented
  261. #define IL2CPP_ISDEBUGGERPRESENT_IMPLEMENTED 1
  262. #else
  263. #define IL2CPP_ISDEBUGGERPRESENT_IMPLEMENTED 0
  264. #endif
  265. #ifndef IL2CPP_USE_POSIX_COND_TIMEDWAIT_REL
  266. #define IL2CPP_USE_POSIX_COND_TIMEDWAIT_REL ( IL2CPP_TARGET_DARWIN || IL2CPP_TARGET_PSP2 || ( IL2CPP_TARGET_ANDROID && !defined(__aarch64__) ) )
  267. #endif
  268. template<bool value>
  269. struct Il2CppStaticAssertHelper;
  270. template<>
  271. struct Il2CppStaticAssertHelper<true>
  272. {
  273. };
  274. #define Assert(x) do { (void)(x); IL2CPP_ASSERT(x); } while (false)
  275. #define Il2CppStaticAssert(...) do { Il2CppStaticAssertHelper<(__VA_ARGS__)>(); } while (false)
  276. const int32_t kIl2CppInt32Min = INT32_MIN;
  277. const int32_t kIl2CppInt32Max = INT32_MAX;
  278. const uint32_t kIl2CppUInt32Max = UINT32_MAX;
  279. const int64_t kIl2CppInt64Min = INT64_MIN;
  280. const int64_t kIl2CppInt64Max = INT64_MAX;
  281. const uint64_t kIl2CppUInt64Max = UINT64_MAX;
  282. #if IL2CPP_SIZEOF_VOID_P == 8
  283. const intptr_t kIl2CppIntPtrMin = kIl2CppInt64Min;
  284. const intptr_t kIl2CppIntPtrMax = kIl2CppInt64Max;
  285. const uintptr_t kIl2CppUIntPtrMax = kIl2CppUInt64Max;
  286. #else
  287. const intptr_t kIl2CppIntPtrMin = kIl2CppInt32Min;
  288. const intptr_t kIl2CppIntPtrMax = kIl2CppInt32Max;
  289. const uintptr_t kIl2CppUIntPtrMax = kIl2CppUInt32Max;
  290. #endif
  291. const int ipv6AddressSize = 16;
  292. #define IL2CPP_SUPPORT_IPV6 !IL2CPP_TARGET_PS4 && !IL2CPP_TARGET_SWITCH
  293. // Android: "There is no support for locales in the C library" https://code.google.com/p/android/issues/detail?id=57313
  294. // PS4/PS2: strtol_d doesn't exist
  295. #define IL2CPP_SUPPORT_LOCALE_INDEPENDENT_PARSING (!IL2CPP_TARGET_ANDROID && !IL2CPP_TARGET_PS4 && !IL2CPP_TARGET_PSP2)
  296. #define NO_UNUSED_WARNING(expr) (void)(expr)
  297. typedef int32_t il2cpp_hresult_t;
  298. // Sorted numerically!
  299. #define IL2CPP_S_OK ((il2cpp_hresult_t)0)
  300. #define IL2CPP_E_BOUNDS ((il2cpp_hresult_t)0x8000000B)
  301. #define IL2CPP_E_CHANGED_STATE ((il2cpp_hresult_t)0x8000000C)
  302. #define IL2CPP_E_ILLEGAL_METHOD_CALL ((il2cpp_hresult_t)0x8000000E)
  303. #define IL2CPP_RO_E_CLOSED ((il2cpp_hresult_t)0x80000013)
  304. #define IL2CPP_E_NOTIMPL ((il2cpp_hresult_t)0x80004001)
  305. #define IL2CPP_E_NOINTERFACE ((il2cpp_hresult_t)0x80004002)
  306. #define IL2CPP_E_POINTER ((il2cpp_hresult_t)0x80004003)
  307. #define IL2CPP_E_ABORT ((il2cpp_hresult_t)0x80004004)
  308. #define IL2CPP_E_FAIL ((il2cpp_hresult_t)0x80004005)
  309. #define IL2CPP_E_UNEXPECTED ((il2cpp_hresult_t)0x8000FFFF)
  310. #define IL2CPP_RPC_E_DISCONNECTED ((il2cpp_hresult_t)0x80010108)
  311. #define IL2CPP_RPC_E_WRONG_THREAD ((il2cpp_hresult_t)0x8001010E)
  312. #define IL2CPP_DISP_E_PARAMNOTFOUND ((il2cpp_hresult_t)0x80020004)
  313. #define IL2CPP_REGDB_E_CLASSNOTREG ((il2cpp_hresult_t)0x80040154)
  314. #define IL2CPP_E_ACCESS_DENIED ((il2cpp_hresult_t)0x80070005)
  315. #define IL2CPP_E_OUTOFMEMORY ((il2cpp_hresult_t)0x8007000E)
  316. #define IL2CPP_E_INVALIDARG ((il2cpp_hresult_t)0x80070057)
  317. #define IL2CPP_COR_E_EXCEPTION ((il2cpp_hresult_t)0x80131500)
  318. #define IL2CPP_COR_E_INVALIDOPERATION ((il2cpp_hresult_t)0x80131509)
  319. #define IL2CPP_COR_E_PLATFORMNOTSUPPORTED ((il2cpp_hresult_t)0x80131539)
  320. #define IL2CPP_COR_E_OPERATIONCANCELED ((il2cpp_hresult_t)0x8013153B)
  321. #define IL2CPP_COR_E_OBJECTDISPOSED ((il2cpp_hresult_t)0x80131622)
  322. #define IL2CPP_HR_SUCCEEDED(hr) (((il2cpp_hresult_t)(hr)) >= 0)
  323. #define IL2CPP_HR_FAILED(hr) (((il2cpp_hresult_t)(hr)) < 0)
  324. #include "il2cpp-api-types.h"
  325. #define IL2CPP_LITTLE_ENDIAN 1
  326. #define IL2CPP_BIG_ENDIAN 2
  327. #define IL2CPP_BYTE_ORDER IL2CPP_LITTLE_ENDIAN
  328. #if (defined(_MSC_VER) && _MSC_VER > 1600) || (__has_feature(cxx_override_control))
  329. #define IL2CPP_OVERRIDE override
  330. #define IL2CPP_FINAL final
  331. #else
  332. #define IL2CPP_OVERRIDE
  333. #define IL2CPP_FINAL
  334. #endif
  335. #if (__has_feature(cxx_deleted_functions) || (defined(_MSC_VER) && _MSC_VER >= 1800))
  336. #define IL2CPP_HAS_DELETED_FUNCTIONS 1
  337. #else
  338. #define IL2CPP_HAS_DELETED_FUNCTIONS 0
  339. #endif
  340. #if IL2CPP_TARGET_WINDOWS
  341. const Il2CppChar kIl2CppNewLine[] = { '\r', '\n', '\0' };
  342. #else
  343. const Il2CppChar kIl2CppNewLine[] = { '\n', '\0' };
  344. #endif
  345. #if IL2CPP_TARGET_ANDROID && defined(__i386__)
  346. // On Android with x86, function pointers are not aligned, so we
  347. // need to use all of the bits when comparing them. Hence we mask
  348. // nothing.
  349. #define IL2CPP_POINTER_SPARE_BITS 0
  350. #else
  351. // On ARMv7 with Thumb instructions the lowest bit is always set.
  352. // With Thumb2 the second-to-lowest bit is also set. Mask both of
  353. // them off so that we can do a comparison properly based on the data
  354. // from the linker map file. On other architectures this operation should
  355. // not matter, as we assume these two bits are always zero because the pointer
  356. // will be aligned.
  357. #define IL2CPP_POINTER_SPARE_BITS 3
  358. #endif
  359. #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."
  360. #if IL2CPP_COMPILER_MSVC
  361. #define IL2CPP_ATTRIBUTE_WEAK
  362. #else
  363. #define IL2CPP_ATTRIBUTE_WEAK __attribute__((weak))
  364. #endif
  365. #if IL2CPP_TARGET_XBOXONE || IL2CPP_TARGET_WINRT || IL2CPP_TARGET_ANDROID || IL2CPP_TARGET_PS4 || IL2CPP_TARGET_PSP2
  366. #define IL2CPP_USE_GENERIC_CPU_INFO 1
  367. #else
  368. #define IL2CPP_USE_GENERIC_CPU_INFO 0
  369. #endif
  370. #define IL2CPP_CAN_CHECK_EXECUTABLE IL2CPP_TARGET_WINDOWS || (IL2CPP_TARGET_POSIX && !IL2CPP_TARGET_PS4)