What we must agree is, different platforms have different ways of understanding the assemblies. They execute and run the app in the same way. So Xamarin compiles the app in relevance to the platforms basing upon their nature and behavior of executing the assemblies. So that the app assembly fits to the platform acceptable format and run.
Compiling for iOS
iOS runs on ARM architecture. So the nature of iOS is, it understands the assembly language for ARM. It never allows the code to be generated dynamically during run time. So to respect the same, Xamarin did it exactly. It uses the Ahead Of Time (AOT) compilation process in order to generate ARM assemblies from the static code. This is a process to generate the pre-compiled code. Unlike the traditional on-demand execution approach, it compiles the code before hand. During the linking process, it links the .Net framework and the relevant assemblies only. It removes all others, which are no longer in use.
- App size gets reduced, since only relevant assemblies are included
- Start up and performance also gets better due to the AOT pre-compilation
- Support for Generics get limited, which is some how good.
Compiling for Android
Android runs on Linux karnel with Dalvik VM powered by Java. Xamarin compiles the C# code to Intermediate Language (IL). The IL again gets packaged with the MonoVM and JIT. This whole package runs in parallel with the DalvikVM in order to consume the native APIs. Like the iOS compilation process it also remove the unused library.
Compiling for Windows phone
Xamarin has nothing to do with the compilation for Windows Phone. It compiles normally with .Net framework.
Hope this will help 🙂
Please share your feedback.