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