Jump to content
  • Advertisement
Sign in to follow this  

[Advance topic] Research and Development - cross compiling to mobile platforms

This topic is 1126 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hi guys,


here is a background, my company(i dont own, i just work on) who is having an R&D project on how to make a cross platform framework or tools that can compile to various targets specifically for Android and IOS target.

SInce this is an R&D project, time and effort is not the issue as it is ok for us to take time to develop this. A little background, our company is NOT a game dev company but is planning to enter the gamedev space by offering tools and/or engines to some of our clients.

our engineers are experienced engineers(10+ years) but mostly working on firmware and drivers and graphics( ala printer company) but have no experienced in working for mobile ios or android, we have idea how we just want to know feedback from industry.


basically, what we want is similar to cross platform tools like marmalade SDK or xamarin, or any other 3rd party engine/tools that user write once and compiles and run to ios and android,


1. how did they do it? any book/resources or things to look into for this? like compiling to ARM, etc?

2. do they have some sort of 'virtual machine' just like java that are deployed together with the app?

3. we are mostly confuse with the iOS part as they use objective C, if we use an interface or adapters to native IOS functionality, how do we link a C++ code to IOS native? sort of like that.

how would a code written in C++ or C# like marmalade or Xamarin can compile and run in an iOS? did they provide wrapers in objective C?


any help and usefull information, links, resources, books to buy, etc. will do.


Edited by cebugdev

Share this post

Link to post
Share on other sites

You've mixed a few different types of tools there. I'll try to break them down, but you've got a long way to go here.



1a, how do these cross compilers do it?  Compilers for a mobile device is a cross compiler.  That is, it is a compiler that runs on one platform (like a Windows PC in the x86 family) and generates code that runs on another platform (perhaps an Android machine in the ARM family).  There is nothing particularly magical about these tools, they take source code and compile it into CPU instructions.  Any compiler for any language is going to generate output targeting a specific machine.  Some systems like the Gnu Compiler Collection are able to generate different code for a lot of machines; it can compile your C++ code into Windows x86 instructions, Linux x86 instructions, Solaris x86 instructions, Linux ARM instructions, AIX instructions, and more. The compiler takes input in one language (perhaps c++) and transforms it to another language (system-specific machine code).


1b, any books/resources for learning?  Any good book on compilers will cover this material. Compiler theory is standard in most collegiate computer science degrees.


2, do they have virtual machines that are deployed?  Some of the tools you mentioned provide support for scripting languages. These are a virtual machine.  They are instructions that are encoded for another program to load and process.  So just like a Java virtual machine loads a jar file and turns the Java bytecode into instructions that are appropriate for the platform, these scripting systems will load a data file and turn the script code into instructions that are appropriate for the platform.  Some instructions map perfectly to CPU instructions, things like addition or multiplication are directly available.  Other operations may require the virtual machine or scripting system to do considerable work. For example, the Java bytecode instruction instanceof (bytecode 0xc1) triggers all kinds of work, it checks for null and handles it, then it searches the class loader data to search for execution-time dynamic type of the object, then it goes out to the type hierarchy and runs a whole bunch of comparisons to either find a matching type or discover that there is no matching type.  Exactly what a given program has for processing data depends on that program.


3a, how do I use C++ on iOS?  Many of the systems on an iPhone only have an Objective C interface. Apple's compilers and linkers can compile plain old C++ code and make it talks Objective C and Objective C++ code. Go to Apple's developer web site and read the tutorials and documentation about how to use the compiler, the compiler and linker options that are required, and the rest.  


3b, how do Marmalade or Xamarin do it?  These companies wrote the wrappers themselves.  They invested significant time and effort in building their products.  Instead of calling the iOS commands directly you make calls to their Marmalade or Xamarin libraries, and those libraries do the work for you.


our engineers are experienced engineers(10+ years) but mostly working on firmware and drivers and graphics


Then your engineers should have no problem at all with any of this stuff, and likely already have a solid understanding of all these questions except for 3a.  Even though they couldn't answer that one question directly, they would know that they need to look it up on the manufacturer's web site.  


If these are your employees, I strongly suggest you talk with them.  They can probably explain it to you in a way you are comfortable with.

Edited by frob

Share this post

Link to post
Share on other sites

You should take a look at toolchain, it's what used to compile cross-platform, you can easily find toolchain for Android ans IOS for CMake.

You will have to modify them a little to have them working correctly.

Edited by Alundra

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!