如何确定C code语言是编译为Android / NDK或iOS的译为、语言、code、iOS

2023-09-06 03:18:23 作者:找回遗失的自己

我重新使用传统的C库在iOS应用和Android应用程序。我想自定义一些宏定义(如日志记录)。有没有标准的定义检查(使用的#ifdef)的code是否被编译为iOS或Android / NDK?

I am reusing a legacy C library in an iOS app and in an Android app. I want to customize some macro definitions (e.g. for logging). Are there standard defines to check for (using #ifdef) whether the code is being compiled for iOS or Android/NDK?

推荐答案

__ ANDROID __ 机器人为Android(编译与NDK) 和 __ __苹果苹果平台(iOS和OSX)

__ANDROID__ or ANDROID for Android (compilation with the NDK) and __APPLE__ on Apple platforms (iOS or OSX)