开发者

How to determine C code is compiled for Android/NDK or iOS

开发者 https://www.devze.com 2023-01-28 12:49 出处:网络
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 c

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 fo开发者_如何学Cr iOS or Android/NDK?


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


you should consider creating two separate projects for those platforms with separate output/bin directories but shared source code. Then you just set some define in project properties for android and ios so you can recognize it when compiling

0

精彩评论

暂无评论...
验证码 换一张
取 消