Hemant Metalia
Hemant Metalia

Reputation: 30648

The impact of native code in Android/iPhone app development

I want to create an app for Android and for iOS.

Now, I have to use lot of native C++ code in my application.
So I'd like to know:

Upvotes: 3

Views: 3067

Answers (4)

David Dunham
David Dunham

Reputation: 8329

For iOS: It's totally fine to use Objective-C++ — my game code was in C++ and so most of the UI (that talks to C++ model objects) is in Objective-C++. C++ is just as native as Objective-C, both can be considered C dialects that compile to machine instructions.

Upvotes: 1

hotpaw2
hotpaw2

Reputation: 70703

Full access to the native UI controls and events will usually involve using Objective C on iOS and Java for Dalvik on Android. The compute kernel, Model object internals, Open GL rendering, and such, can all be done in C/C++. On Mac OS X and iOS, Objective C++ is native code, and thus will run as fast as native code (assuming your code itself isn't slow). On Android, there may be a small overhead calling through the NDK interface.

The iOS security sandbox does not allow full access to the control of all resources from any app on a stock OS device.

Upvotes: 4

xorange
xorange

Reputation: 191

I don't have any IOS dev. experience so I'm just gonna talk about Android.

Android NDK is used for using the native code.

NDK promises several, not full, control of the resources. It's not suggested to implement your app purely using native code. "In general, you should only use native code if it is essential to your application, not just because you prefer to program in C/C++." Details in #When to Develop in Native Code.

Upvotes: 3

SentineL
SentineL

Reputation: 4732

you can use c or c++ code as well as objective-c on iOS (in case of c++ you need to rename source file from *.m to *.mm). but apple do not recommed it. Do not shure about android.

EDIT

Also, I just remembered: my friend used thirdprty library in c in android. So, you can use it there too

Upvotes: 1

Related Questions