MonoTouch 5.3.2 is now available (in the alpha channel) and if you look at your application size you’ll notice an executable that’s a bit smaller than before. It must be the linker right ? sort of.
The managed linker (the one I often write about) is unchanged in this new alpha release – but it’s not the only linker being used when building MonoTouch applications. The native linker, part of gcc and coming with Apple iOS SDK, also plays a role in removing unused code. Has this linker changed ? no, but the Mono[Touch] runtime has.
The Mono runtime has internal calls (icalls), i.e. native functions that are called from managed code. E.g. to get the sinus of an angle you call the System.Math.Sin(double) method, which is defined like this:
public extern static double Sin (double a);
and, because of the [MethodImp(MethodImplOptions.InternalCall)] attribute, the call ends up inside the following function of the Mono runtime:
ves_icall_System_Math_Sin (gdouble x)
return sin (x);
In many ways it’s similar to p/invokes but, until this release, it was not possible for the native linker to remove the unused icalls (native code) from your applications, i.e. you always got every icall MonoTouch was built with.
Read more: take a bit, get a byte