UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
egttypes.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#if !defined(__EGTTYPESH__) && !defined(__RADTYPESH__) && !defined(__RADRR_COREH__)
4#define __RADTYPESH__
5#define __EGTTYPESH__
6#define __RADRR_COREH__ // block old rr_core
7
8#if !defined(__RADRES__) // don't include anything for resource compiles
9
10// __RAD32__ means at least 32 bit code (always defined)
11// __RAD64__ means 64 bit addressing (64-bit OSes only) (__RAD64REGS__ will be set)
12// __RAD64REGS__ means 64 bit registers
13
14// __RADNT__ means Win32 and Win64 desktop
15// __RADWINRT__ means Windows Store/Phone App (x86, x64, arm)
16// __RADWIN__ means win32, win64, windows store/phone, consoles
17// __RADWINRTAPI__ means Windows RT API (Win Store, Win Phone, consoles)
18// __RADMAC__ means MacOS (32 or 64-bit)
19// __RADANDROID__ means Android NDK
20// __RADLINUX__ means Linux (32 or 64-bit)
21// __RADQNX__ means QNX
22// __RADIPHONE__ means iphone (ios, tvos, or watchos)
23// __RADIOS__ means iOS (+ __RADIPHONE__ will also be set)
24// __RADTVOS__ means tvOS (+ __RADIPHONE__ will also be set)
25// __RADWATCHOS__ means watchOS (+ __RADIPHONE__ will also be set)
26// __RADEMSCRIPTEN__ means Emscripten
27
28// __RADARM__ means arm
29// __RADPPC__ means powerpc
30// __RADX86__ means x86 or x64
31// __RADX64__ means x64 (+ __RADX86__ will also be set)
32// __RADNEON__ means you can use NEON intrinsics on ARM
33// __RADSSE2__ means you can use SSE2 intrinsics on X86
34
35// __RADNOVARARGMACROS__ means #defines can't use ...
36
37// RADDEFSTART is "extern "C" {" on C++, nothing on C
38// RADDEFEND is "}" on C++, nothing on C
39
40// RADEXPFUNC and RADEXPLINK are used on both the declaration
41// and definition of exported functions.
42// RADEXPFUNC int RADEXPLINK exported_func()
43
44// RADDEFFUNC and RADLINK are used on both the declaration
45// and definition of public functions (but not exported).
46// RADDEFFUNC int RADLINK public_c_func()
47
48// RADRESTRICT is for non-aliasing pointers/
49
50// RADSTRUCT is defined as "struct" on msvc, and
51// "struct __attribute__((__packed__))" on gcc/clang
52// Used to sort of address generic structure packing
53// (we still require #pragma packs to fix the
54// packing on windows, though)
55
56
57// ========================================================
58// C++ name demangling nonsense
59
60#ifdef __cplusplus
61 #define RADDEFFUNC extern "C"
62 #define RADDEFSTART extern "C" {
63 #define RADDEFEND }
64 #define RADDEFAULT( val ) =val
65#else
66 #define RADDEFFUNC
67 #define RADDEFSTART
68 #define RADDEFEND
69 #define RADDEFAULT( val )
70#endif
71
72//===========================================================================
73// preprocessor string stuff
74#define RR_STRINGIZE( L ) #L
75#define RR_DO_MACRO( M, X ) M(X)
76#define RR_STRINGIZE_DELAY( X ) RR_DO_MACRO( RR_STRINGIZE, X )
77
78#define RR_STRING_JOIN(arg1, arg2) RR_STRING_JOIN_DELAY(arg1, arg2)
79#define RR_STRING_JOIN_DELAY(arg1, arg2) RR_STRING_JOIN_IMMEDIATE(arg1, arg2)
80#define RR_STRING_JOIN_IMMEDIATE(arg1, arg2) arg1 ## arg2
81
82// makes "plat/plat_file"
83#define RR_PLATFORM_PATH_STR( plat, file ) RR_STRINGIZE_DELAY( RR_STRING_JOIN( plat, file ) )
84
85
86// ========================================================
87// First off, we detect your platform
88
89#ifdef __RAD_NDA_PLATFORM__
90
91 #include RR_PLATFORM_PATH_STR( __RAD_NDA_PLATFORM__, _egttypes.h )
92
93#else
94
95 #if defined(ANDROID)
96 #define __RADANDROID__ 1
97 #define __RADDETECTED__ __RADANDROID__
98 #endif
99
100 #if defined(__QNX__)
101 #define __RADQNX__ 2
102 #define __RADDETECTED__ __RADQNX__
103 #endif
104
105 #if defined(_Windows) || defined(WIN32) || defined(__WINDOWS__) || defined(_WIN32) || defined(_WIN64) || defined(WINAPI_FAMILY)
106
107 #ifdef WINAPI_FAMILY
108 // If this is #defined, we might be in a Windows Store App. But
109 // VC++ by default #defines this to a symbolic name, not an integer
110 // value, and those names are defined in "winapifamily.h". So if
111 // WINAPI_FAMILY is #defined, #include the header so we can parse it.
112 #include <winapifamily.h>
113 #define RAD_WINAPI_IS_APP (!WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP))
114 #if RAD_WINAPI_IS_APP
115 #define __RADWINRTAPI__
116 #define __RADWINRT__ 13
117 #define __RADDETECTED__ __RADWINRT__
118 #endif
119 #else
120 #define RAD_WINAPI_IS_APP 0
121 #endif
122
123 #ifndef __RADWINRT__
124 // if we aren't WinRT, then we are plain old NT
125 #define __RADNT__ 14
126 #define __RADDETECTED__ __RADNT__
127 #endif
128 #endif
129
130 #if defined(__APPLE__)
131 #include "TargetConditionals.h"
132 #if defined(TARGET_IPHONE_SIMULATOR) && TARGET_IPHONE_SIMULATOR
133 #define __RADIPHONE__ 15
134 #define __RADIPHONESIM__ 16
135 #define __RADDETECTED__ __RADIPHONESIM__
136 #elif defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE
137 #define __RADIPHONE__ 15
138 #define __RADDETECTED__ __RADIPHONE__
139 #else
140 #define __RADMAC__ 17
141 #define __RADDETECTED__ __RADMAC__
142 #endif
143 // IOS/TVOIS/WATCHOS are subsets of __RADIPHONE__
144 #if defined(TARGET_OS_IOS) && TARGET_OS_IOS
145 #define __RADIOS__ 18
146 #endif
147 #if defined(TARGET_OS_TVOS) && TARGET_OS_TVOS
148 #define __RADTVOS__ 19
149 #endif
150 #if defined(TARGET_OS_WATCHOS) && TARGET_OS_WATCHOS
151 #define __RADWATCHOS__ 20
152 #endif
153 #endif
154
155 #if defined(__EMSCRIPTEN__)
156 #define __RADEMSCRIPTEN__ 22
157 #define __RADDETECTED__ __RADEMSCRIPTEN__
158 #endif
159
160 // linux is catch all for platforms when not compiling internally at rad
161 #if defined(__linux__) && !defined(ANDROID)
162 #define __RADLINUX__ 3
163 #define __RADDETECTED__ __RADLINUX__
164 #endif
165
166 #if !defined( __RADDETECTED__) && !defined( USING_EGT )
167 // this is the catch all, when you aren't building internally at rad
168 #define __RADUNKNOWN__ 99
169 #define __RADDETECTED__ __RADUNKNOWN__
170 #endif
171
172#endif
173
174
175#if !defined(__RADDETECTED__)
176 #error "egttypes.h did not detect your platform."
177#endif
178
179// ========================================================
180// Now detect some architexture stuff
181
182#define __RAD32__ // we have no non-at-least-32-bit cpus any more
183
184#if defined(__arm__) || defined( _M_ARM )
185 #define __RADARM__ 1
186 #define __RADDETECTEDPROC__ __RADARM__
187 #define __RADLITTLEENDIAN__
188 #if defined(__ARM_NEON__) || defined(__ARM_NEON)
189 #define __RADNEON__
190 #endif
191 #if !defined(__RADSOFTFP__) && !defined( __ARM_PCS_VFP )
192 #define __RADSOFTFP__
193 #endif
194#endif
195#if defined(__i386) || defined( __i386__ ) || defined( _M_IX86 ) || defined( _X86_ )
196 #define __RADX86__ 2
197 #if !defined __RADIPHONESIM__
198 // only use mmx on PC, Win, Linux - not iphone sim!
199 #define __RADMMX__
200 #endif
201 #define __RADDETECTEDPROC__ __RADX86__
202 #define __RADLITTLEENDIAN__
203#endif
204#if defined(_x86_64) || defined( __x86_64__ ) || defined( _M_X64 ) || defined( _M_AMD64 )
205 #define __RADX86__ 2
206 #define __RADX64__ 3
207 #if !defined __RADIPHONESIM__
208 #define __RADMMX__
209 #endif
210 #define __RADDETECTEDPROC__ __RADX64__
211 #define __RADLITTLEENDIAN__
212#endif
213#if defined(__powerpc) || defined( _M_PPC )
214 #define __RADPPC__ 4
215 #define __RADALTIVEC__
216 #define __RADDETECTEDPROC__ __RADPPC__
217 #define __RADBIGENDIAN__
218#endif
219#if defined( __aarch64__ ) || defined( __arm64__ ) || defined(_M_ARM64)
220 #define __RADARM__ 1
221 #define __RADARM64__ 6
222 #define __RADDETECTEDPROC__ __RADARM64__
223 #define __RADLITTLEENDIAN__
224 #define __RADNEON__
225#endif
226#if defined(__EMSCRIPTEN__)
227 #define __RADDETECTEDPROC__
228 #define __RADLITTLEENDIAN__
229#endif
230
231#if !defined(__RADDETECTEDPROC__)
232 #error "egttypes.h did not detect your processor type."
233#endif
234
235#if defined(__ppc64__) || defined(__aarch64__) || defined(_M_X64) || defined(__x86_64__) || defined(__x86_64) || defined(_M_ARM64)
236 #define __RAD64__
237 #define __RAD64REGS__ // need to set this for platforms that aren't 64-bit, but have 64-bit regs (old consoles)
238#endif
239
240
241// ========================================================
242// handle exported function declarations:
243// in anything with __RADNOEXPORTS__, RADEXPFUNC == nothing (turn off exports with this flag)
244// in DLL, RADEXPFUNC == DLL export
245// in EXE, RADEXPFUNC == DLL import
246// in EXE with RADNOEXEEXPORTS, RADEXPFUNC == nothing (turn off imports in EXE with this flag)
247// in static lib, RADEXPFUNC == nothing
248#if ( defined(__RADINSTATICLIB__) || defined(__RADNOEXPORTS__ ) || ( defined(__RADNOEXEEXPORTS__) && ( !defined(__RADINDLL__) ) && ( !defined(__RADINSTATICLIB__) ) ) )
249 // if we are in a static lib, or exports are off, or if we are in an EXE we asked for no exe exports (or imports)
250 // then EXPFUNC is just a normal function
251 #define RADEXPFUNC RADDEFFUNC
252#else
253 // otherwise, we use import or export base on the build flag __RADINDLL__
254 #if defined(__RADINDLL__)
255 #define RADEXPFUNC RADDEFFUNC RADDLLEXPORTDLL
256 #else
257 #define RADEXPFUNC RADDEFFUNC RADDLLIMPORTDLL
258 #endif
259#endif
260
261#if defined(__RADANDROID__)
262 #define RADRESTRICT __restrict
263 #define RADSTRUCT struct __attribute__((__packed__))
264
265 #define RADLINK
266 #define RADEXPLINK
267 #define RADDLLEXPORTDLL __attribute__((visibility("default")))
268 #define RADDLLIMPORTDLL
269#endif
270
271#if defined(__RADQNX__)
272 #define RADRESTRICT __restrict
273 #define RADSTRUCT struct __attribute__((__packed__))
274
275 #define RADLINK
276 #define RADEXPLINK RADLINK
277 #define RADDLLEXPORTDLL
278 #define RADDLLIMPORTDLL
279#endif
280
281#if defined(__RADLINUX__) || defined(__RADUNKNOWN__)
282 #define RADRESTRICT __restrict
283 #define RADSTRUCT struct __attribute__((__packed__))
284
285 #if defined(__RADX86__) && !defined(__RADX64__)
286 #define RADLINK __attribute__((cdecl))
287 #define RADEXPLINK __attribute__((cdecl))
288 #else
289 #define RADLINK
290 #define RADEXPLINK
291 #endif
292 // for linux, we assume you are building with hidden visibility,
293 // so for RADEXPFUNC, we turn the vis back on...
294 #define RADDLLEXPORTDLL __attribute__((visibility("default")))
295 #define RADDLLIMPORTDLL
296#endif
297
298#if defined(__RADNT__)
299 #define __RADWIN__
300 #if _MSC_VER >= 1400
301 #define RADRESTRICT __restrict
302 #else
303 // vc6 and older
304 #define RADRESTRICT
305 #define __RADNOVARARGMACROS__
306 #endif
307 #define RADSTRUCT struct
308
309 #define RADLINK __stdcall
310 #define RADEXPLINK __stdcall
311
312 #define RADDLLEXPORTDLL __declspec(dllexport)
313 #ifdef __RADX32__
314 // on weird NT DLLs built to run on Linux and Mac, no imports
315 #define RADDLLIMPORTDLL
316 #else
317 // normal win32 dll import
318 #define RADDLLIMPORTDLL __declspec(dllimport)
319 #endif
320#endif
321
322#if defined(__RADWINRT__)
323 #define __RADWIN__
324 #if defined(__RADARM__) // no non-NEON ARMs in WinRT devices (so far)
325 #define __RADNEON__
326 #endif
327 #define RADRESTRICT __restrict
328 #define RADSTRUCT struct
329
330 #define RADLINK __stdcall
331 #define RADEXPLINK __stdcall
332 #define RADDLLEXPORTDLL __declspec(dllexport)
333 #define RADDLLIMPORTDLL __declspec(dllimport)
334#endif
335
336#if defined(__RADIPHONE__)
337 #define __RADMACAPI__
338 #define RADRESTRICT __restrict
339 #define RADSTRUCT struct __attribute__((__packed__))
340
341 #define RADLINK
342 #define RADEXPLINK
343 #define RADDLLEXPORTDLL
344 #define RADDLLIMPORTDLL
345#endif
346
347#if defined(__RADMAC__)
348 #define __RADMACH__
349 #define __RADMACAPI__
350 #define RADRESTRICT __restrict
351 #define RADSTRUCT struct __attribute__((__packed__))
352
353 #define RADLINK
354 #define RADEXPLINK
355 // for mac, we assume you are building with hidden visibility,
356 // so for RADEXPFUNC, we turn the vis back on...
357 #define RADDLLEXPORTDLL __attribute__((visibility("default")))
358 #define RADDLLIMPORTDLL
359
360 #ifdef TARGET_API_MAC_CARBON
361 #if TARGET_API_MAC_CARBON
362 #ifndef __RADCARBON__
363 #define __RADCARBON__
364 #endif
365 #endif
366 #endif
367#endif
368
369#if defined(__RADEMSCRIPTEN__)
370 #include <emscripten.h>
371 #define RADRESTRICT __restrict
372 #define RADSTRUCT struct __attribute__((__packed__))
373
374 #define RADLINK
375 #define RADEXPLINK EMSCRIPTEN_KEEPALIVE
376 #define RADDLLEXPORTDLL
377 #define RADDLLIMPORTDLL
378#endif
379
380#ifndef RADLINK
381 #error RADLINK was not defined.
382#endif
383
384#ifdef _MSC_VER
385 #define RADINLINE __inline
386#else
387 #define RADINLINE inline
388#endif
389
390//===========================================================================
391// RR_NUMBERNAME is a macro to make a name unique, so that you can use it to declare
392// variable names and they won't conflict with each other
393// using __LINE__ is broken in MSVC with /ZI , but __COUNTER__ is an MSVC extension that works
394
395#ifdef _MSC_VER
396 #define RR_NUMBERNAME(name) RR_STRING_JOIN(name,__COUNTER__)
397#else
398 #define RR_NUMBERNAME(name) RR_STRING_JOIN(name,__LINE__)
399#endif
400
401//===================================================================
402// simple compiler assert
403// this happens at declaration time, so if it's inside a function in a C file, drop {} around it
404#ifndef RR_COMPILER_ASSERT
405 #if defined(__clang__)
406 #define RR_COMPILER_ASSERT_UNUSED __attribute__((unused)) // hides warnings when compiler_asserts are in a local scope
407 #else
408 #define RR_COMPILER_ASSERT_UNUSED
409 #endif
410
411 #define RR_COMPILER_ASSERT(exp) typedef char RR_NUMBERNAME(_dummy_array) [ (exp) ? 1 : -1 ] RR_COMPILER_ASSERT_UNUSED
412#endif
413
414
415//===========================================
416// first, we set defines for each of the types
417
418#define RAD_S8 signed char
419#define RAD_U8 unsigned char
420#define RAD_U16 unsigned short
421#define RAD_S16 signed short
422
423#if defined(__RAD64__)
424 #define RAD_U32 unsigned int
425 #define RAD_S32 signed int
426
427 // pointers are 64 bits.
428 #if ( defined(_MSC_VER) && _MSC_VER >= 1300 && defined(_Wp64) && _Wp64 )
429 #define RAD_SINTa __w64 signed __int64
430 #define RAD_UINTa __w64 unsigned __int64
431 #else
432 // non-vc.net compiler or /Wp64 turned off
433 #define RAD_UINTa unsigned long long
434 #define RAD_SINTa signed long long
435 #endif
436#endif
437
438#if defined(__RAD32__) && !defined(__RAD64__)
439 #define RAD_U32 unsigned int
440 #define RAD_S32 signed int
441
442 #if ( ( defined(_MSC_VER) && (_MSC_VER >= 1300 ) ) && ( defined(_Wp64) && ( _Wp64 ) ) )
443 #define RAD_SINTa __w64 signed long
444 #define RAD_UINTa __w64 unsigned long
445 #else
446 // non-vc.net compiler or /Wp64 turned off
447 #ifdef _Wp64
448 #define RAD_SINTa signed long
449 #define RAD_UINTa unsigned long
450 #else
451 #define RAD_SINTa signed int
452 #define RAD_UINTa unsigned int
453 #endif
454 #endif
455#endif
456
457#define RAD_F32 float
458#define RAD_F64 double
459
460#if defined(_MSC_VER)
461 #define RAD_U64 unsigned __int64
462 #define RAD_S64 signed __int64
463#else
464 #define RAD_U64 unsigned long long
465 #define RAD_S64 signed long long
466#endif
467
468
469//================================================================
470// Then, we either typedef or define them based on switch settings
471
472#if !defined(RADNOTYPEDEFS) // this define will turn off typedefs
473
474 #ifndef S8_DEFINED
475 #define S8_DEFINED
476 typedef RAD_S8 S8;
477 #endif
478
479 #ifndef U8_DEFINED
480 #define U8_DEFINED
481 typedef RAD_U8 U8;
482 #endif
483
484 #ifndef S16_DEFINED
485 #define S16_DEFINED
486 typedef RAD_S16 S16;
487 #endif
488
489 #ifndef U16_DEFINED
490 #define U16_DEFINED
491 typedef RAD_U16 U16;
492 #endif
493
494 #ifndef S32_DEFINED
495 #define S32_DEFINED
496 typedef RAD_S32 S32;
497 #endif
498
499 #ifndef U32_DEFINED
500 #define U32_DEFINED
501 typedef RAD_U32 U32;
502 #endif
503
504 #ifndef S64_DEFINED
505 #define S64_DEFINED
506 typedef RAD_S64 S64;
507 #endif
508
509 #ifndef U64_DEFINED
510 #define U64_DEFINED
511 typedef RAD_U64 U64;
512 #endif
513
514 #ifndef F32_DEFINED
515 #define F32_DEFINED
516 typedef RAD_F32 F32;
517 #endif
518
519 #ifndef F64_DEFINED
520 #define F64_DEFINED
521 typedef RAD_F64 F64;
522 #endif
523
524 #ifndef SINTa_DEFINED
525 #define SINTa_DEFINED
527 #endif
528
529 #ifndef UINTa_DEFINED
530 #define UINTa_DEFINED
532 #endif
533
534 #ifndef RRBOOL_DEFINED
535 #define RRBOOL_DEFINED
536 typedef S32 rrbool;
537 typedef S32 RRBOOL;
538 #endif
539
540#elif !defined(RADNOTYPEDEFINES) // this define will turn off type defines
541
542 #ifndef S8_DEFINED
543 #define S8_DEFINED
544 #define S8 RAD_S8
545 #endif
546
547 #ifndef U8_DEFINED
548 #define U8_DEFINED
549 #define U8 RAD_U8
550 #endif
551
552 #ifndef S16_DEFINED
553 #define S16_DEFINED
554 #define S16 RAD_S16
555 #endif
556
557 #ifndef U16_DEFINED
558 #define U16_DEFINED
559 #define U16 RAD_U16
560 #endif
561
562 #ifndef S32_DEFINED
563 #define S32_DEFINED
564 #define S32 RAD_S32
565 #endif
566
567 #ifndef U32_DEFINED
568 #define U32_DEFINED
569 #define U32 RAD_U32
570 #endif
571
572 #ifndef S64_DEFINED
573 #define S64_DEFINED
574 #define S64 RAD_S64
575 #endif
576
577 #ifndef U64_DEFINED
578 #define U64_DEFINED
579 #define U64 RAD_U64
580 #endif
581
582 #ifndef F32_DEFINED
583 #define F32_DEFINED
584 #define F32 RAD_F32
585 #endif
586
587 #ifndef F64_DEFINED
588 #define F64_DEFINED
589 #define F64 RAD_F64
590 #endif
591
592 #ifndef SINTa_DEFINED
593 #define SINTa_DEFINED
594 #define SINTa RAD_SINTa
595 #endif
596
597 #ifndef UINTa_DEFINED
598 #define UINTa_DEFINED
599 #define UINTa RAD_UINTa
600 #endif
601
602 #ifndef RRBOOL_DEFINED
603 #define RRBOOL_DEFINED
604 #define rrbool S32
605 #define RRBOOL S32
606 #endif
607
608#endif
609
610#endif // __RADRES__
611
612#endif // __EGTTYPESH__
#define RAD_F64
Definition egttypes.h:458
RAD_S16 S16
Definition egttypes.h:486
RAD_SINTa SINTa
Definition egttypes.h:526
#define RAD_F32
Definition egttypes.h:457
RAD_S8 S8
Definition egttypes.h:476
#define RAD_U32
Definition egttypes.h:439
RAD_U32 U32
Definition egttypes.h:501
RAD_U8 U8
Definition egttypes.h:481
RAD_UINTa UINTa
Definition egttypes.h:531
#define RAD_UINTa
Definition egttypes.h:452
S32 rrbool
Definition egttypes.h:536
S32 RRBOOL
Definition egttypes.h:537
#define RAD_S16
Definition egttypes.h:421
#define RAD_S64
Definition egttypes.h:465
RAD_U64 U64
Definition egttypes.h:511
#define RAD_U16
Definition egttypes.h:420
#define RAD_S32
Definition egttypes.h:440
#define RAD_U8
Definition egttypes.h:419
#define RAD_S8
Definition egttypes.h:418
RAD_F64 F64
Definition egttypes.h:521
#define RAD_U64
Definition egttypes.h:464
RAD_F32 F32
Definition egttypes.h:516
RAD_S64 S64
Definition egttypes.h:506
RAD_S32 S32
Definition egttypes.h:496
RAD_U16 U16
Definition egttypes.h:491
#define RAD_SINTa
Definition egttypes.h:451