Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do cross platform mobile C++ SDKs generally work under the hood?

I found a related answer here: How do cross-platform mobile app development frameworks work?

but I was thinking more about c++ cross-platform SDKs work (e.g. Corona, Marmalade, EdgeLib, etc.). They provide the ability to export binaries for iOS and Android while allowing the developer to use C++ code. My assumption is listed below, but please correct it if I am wrong anywhere:

  1. User writes code in C++.
  2. SDK has an interface layer with C++ functions called in user code requesting mobile OS specific functionality. This interface layer is built from code required to implement that SDK function call in the specific mobile OS(written in Java for Android and Obj-C for iOS).
  3. Part I am most confused about because I don't have much mobile dev experience points: Do iOS and Android both have C++ cross compilers that can compile the general logic code written in C++ in the user's app?
like image 997
coderunner Avatar asked Dec 25 '11 11:12

coderunner


2 Answers

MoSync is an example of a C++ based cross platform mobile toolkit - this one starts by using the open source GCC compiler to compile your app's C++ code into an assembly-like format. A custom tool by MoSync (called the 'PipeTool') then combines this assembly format with their pre-compiled libraries into various target formats, including java bytecode (for Android) or Objective-C source (for iOS). More detail about this process here.

The final compilation on the target platform (Android or iOS) is left to you, using the native IDE (Xcode for iOS and Eclipse IDE with Android SDK for Android). So to create an iOS application you'll still need to be a member of the Apple iOS developer program (US$99 per year) for example, whereas the Eclipse IDE and Android SDK are free.

Your example of Corona SDK is not fully relevant since Corona builds into the native binary format using their custom build servers in the cloud - what goes on there is not fully documented as its a closed source toolkit. You pay a subscription fee per year to Corona to be able to build apps. I'm not sure about the other ones you mentioned (Marmalade, EdgeLib, etc.) but would assume they are similar to MoSync.

like image 105
dodgy_coder Avatar answered Sep 24 '22 22:09

dodgy_coder


Check out codenameone.com - they use Java but eventually compile into C++ for iOS and Java for Android.

The difference is their environment includes all the graphics and they create the controls themselves so you get an actual native application with just one codebase.

like image 41
Ram Avatar answered Sep 25 '22 22:09

Ram