UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
AndroidPlatform.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3/*================================================================================
4 AndroidPlatform.h: Setup for the Android platform
5==================================================================================*/
6
7#pragma once
8
10#include "Clang/ClangPlatform.h"
11#include "Misc/Build.h"
12
14#define PLATFORM_ANDROID 1
15
20{
21 //typedef unsigned int DWORD;
22 //typedef size_t SIZE_T;
23 //typedef decltype(NULL) TYPE_OF_NULL;
24 typedef char16_t WIDECHAR;
25 typedef WIDECHAR TCHAR;
26};
27
29
30#define ANDROID_MAX_PATH PATH_MAX
31
32// Base defines, must define these for the platform, there are no defaults
33#define PLATFORM_DESKTOP 0
34#define PLATFORM_CAN_SUPPORT_EDITORONLY_DATA 0
35
36// Base defines, defaults are commented out
37
38#define PLATFORM_LITTLE_ENDIAN 1
39#define PLATFORM_SUPPORTS_PRAGMA_PACK 1
40#define PLATFORM_USE_LS_SPEC_FOR_WIDECHAR 1
41#define PLATFORM_HAS_BSD_TIME 1
42#define PLATFORM_USE_PTHREADS 1
43#define PLATFORM_MAX_FILEPATH_LENGTH_DEPRECATED ANDROID_MAX_PATH
44#define PLATFORM_SUPPORTS_TEXTURE_STREAMING 1
45#define PLATFORM_REQUIRES_FILESERVER 1
46#define PLATFORM_WCHAR_IS_4_BYTES 1
47#define PLATFORM_TCHAR_IS_CHAR16 1
48#define PLATFORM_HAS_NO_EPROCLIM 1
49#define PLATFORM_USES_GLES 1
50#define PLATFORM_BUILTIN_VERTEX_HALF_FLOAT 0
51#define PLATFORM_HAS_BSD_SOCKET_FEATURE_IOCTL 1
52#define PLATFORM_HAS_BSD_SOCKET_FEATURE_MSG_DONTWAIT 1
53#define PLATFORM_HAS_TOUCH_MAIN_SCREEN 1
54#define PLATFORM_HAS_MULTITHREADED_PREMAIN 1
55#define PLATFORM_SUPPORTS_STACK_SYMBOLS 1
56#define PLATFORM_NUM_AUDIODECOMPRESSION_PRECACHE_BUFFERS 2
57#define PLATFORM_USES_ANSI_STRING_FOR_EXTERNAL_PROFILING 1
58#define PLATFORM_UI_HAS_MOBILE_SCROLLBARS 1
59#define PLATFORM_UI_NEEDS_TOOLTIPS 0
60#define PLATFORM_UI_NEEDS_FOCUS_OUTLINES 0
61#define PLATFORM_SUPPORTS_EARLY_MOVIE_PLAYBACK 1 // movies will start before engine is initialized
62#define PLATFORM_SUPPORTS_GEOMETRY_SHADERS (RHI_RAYTRACING) // Currently required due to the way we offset ShaderStage::EStage
63#define PLATFORM_USE_ANSI_POSIX_MALLOC 1
64#define PLATFORM_USE_MINIMAL_HANG_DETECTION 1
65#define PLATFORM_CODE_SECTION(Name) __attribute__((section(Name)))
66#define PLATFORM_ALLOW_ALLOCATIONS_IN_FASYNCWRITER_SERIALIZEBUFFERTOARCHIVE 0
67
68#define PLATFORM_RETURN_ADDRESS_FOR_CALLSTACKTRACING PLATFORM_RETURN_ADDRESS
69
70#define PLATFORM_GLOBAL_LOG_CATEGORY LogAndroid
71
72#define PLATFORM_ENABLE_VECTORINTRINSICS 1
73#define PLATFORM_ENABLE_VECTORINTRINSICS_NEON PLATFORM_ANDROID_ARM64
74
75// Ensure we can use this builtin - seems to be present on Clang 9, GCC 11 and MSVC 19.26,
76// but gives spurious "non-void function 'BitCast' should return a value" errors on some
77// Mac and Android toolchains when building PCHs, so avoid those.
78#undef PLATFORM_COMPILER_SUPPORTS_BUILTIN_BITCAST
79#define PLATFORM_COMPILER_SUPPORTS_BUILTIN_BITCAST (__clang_major__ >= 13)
80
81// some android platform overrides that sub-platforms can disable
82#ifndef USE_ANDROID_JNI
83 #define USE_ANDROID_JNI 1
84#endif
85#ifndef USE_ANDROID_AUDIO
86 #define USE_ANDROID_AUDIO 1
87#endif
88#ifndef USE_ANDROID_FILE
89 #define USE_ANDROID_FILE 1
90#endif
91#ifndef USE_ANDROID_LAUNCH
92 #define USE_ANDROID_LAUNCH 1
93#endif
94#ifndef USE_ANDROID_INPUT
95 #define USE_ANDROID_INPUT 1
96#endif
97#ifndef USE_ANDROID_EVENTS
98 #define USE_ANDROID_EVENTS 1
99#endif
100#ifndef USE_ANDROID_STANDALONE
101 #define USE_ANDROID_STANDALONE 0
102#endif
103#ifndef USE_ANDROID_ALTERNATIVE_SUSPEND
104 #define USE_ANDROID_ALTERNATIVE_SUSPEND 0
105#endif
106
107
108#if (!USE_ANDROID_STANDALONE && UE_BUILD_DEBUG) || (USE_ANDROID_STANDALONE && !UE_BUILD_SHIPPING)
109 // M is the scope for the logging such as LogAndroid, STANDALONE_DEBUG_LOGf should be used when using formatted arguments.
110# define STANDALONE_DEBUG_LOG(M, ...) FPlatformMisc::LowLevelOutputDebugStringf(TEXT(#M " : "),##__VA_ARGS__);
111# define STANDALONE_DEBUG_LOGf(M, ...) FPlatformMisc::LowLevelOutputDebugStringf(TEXT(#M " : ") __VA_ARGS__);
112
113#else
114# define STANDALONE_DEBUG_LOG(...)
115# define STANDALONE_DEBUG_LOGf(...)
116#endif
117
118#define ANDROID_GAMEACTIVITY_BASE_CLASSPATH "com/epicgames/unreal/GameActivity"
119
120#if USE_ANDROID_STANDALONE
121# define ANDROID_GAMEACTIVITY_CLASSPATH "com/epicgames/asis/AsisGameActivity"
122#else
123# define ANDROID_GAMEACTIVITY_CLASSPATH "com/epicgames/unreal/GameActivity"
124#endif
125
126
127
128// Enable to set thread nice values when setting runnable thread priorities
129#ifndef ANDROID_USE_NICE_VALUE_THREADPRIORITY
130 #define ANDROID_USE_NICE_VALUE_THREADPRIORITY 0
131#endif
132
133// Function type macros.
134#define VARARGS /* Functions with variable arguments */
135#define CDECL /* Standard C function */
136#define STDCALL /* Standard calling convention */
137#if UE_BUILD_DEBUG
138 #define FORCEINLINE inline /* Easier to debug */
139#else
140 #define FORCEINLINE inline __attribute__ ((always_inline)) /* Force code to be inline */
141#endif
142#define FORCENOINLINE __attribute__((noinline)) /* Force code to NOT be inline */
143
144#define FUNCTION_CHECK_RETURN_END __attribute__ ((warn_unused_result)) /* Warn that callers should not ignore the return value. */
145#define FUNCTION_NO_RETURN_END __attribute__ ((noreturn)) /* Indicate that the function never returns. */
146
147// Optimization macros
148#define PRAGMA_DISABLE_OPTIMIZATION_ACTUAL _Pragma("clang optimize off")
149#define PRAGMA_ENABLE_OPTIMIZATION_ACTUAL _Pragma("clang optimize on")
150
151// Disable optimization of a specific function
152#define DISABLE_FUNCTION_OPTIMIZATION __attribute__((optnone))
153
154#define ABSTRACT abstract
155
156// DLL export and import definitions
157#define DLLEXPORT __attribute__((visibility("default")))
158#define DLLIMPORT __attribute__((visibility("default")))
159#define JNI_METHOD __attribute__ ((visibility ("default"))) extern "C"
160
161// Alignment.
162#define GCC_PACK(n) __attribute__((packed,aligned(n)))
163#define GCC_ALIGN(n) __attribute__((aligned(n)))
164
165// operator new/delete operators
166// As of 10.9 we need to use _NOEXCEPT & cxx_noexcept compatible definitions
167#if __has_feature(cxx_noexcept)
168#define OPERATOR_NEW_THROW_SPEC
169#else
170#define OPERATOR_NEW_THROW_SPEC throw (std::bad_alloc)
171#endif
172#define OPERATOR_DELETE_THROW_SPEC noexcept
173#define OPERATOR_NEW_NOTHROW_SPEC noexcept
174#define OPERATOR_DELETE_NOTHROW_SPEC noexcept
FAndroidTypes FPlatformTypes
Definition AndroidPlatform.h:28
Definition AndroidPlatform.h:20
WIDECHAR TCHAR
Definition AndroidPlatform.h:25
char16_t WIDECHAR
Definition AndroidPlatform.h:24
Definition GenericPlatform.h:33