On iPhone, mprotect () will fail if you try to use it to mark writable partitions of memory as executable. This destroys bridges, such as RubyCocoa (and probably MacRuby), which use libffi to create Objective-C method handlers at runtime. I believe that this is by design because it is not always the case.
Ultimately, it is more a platform policy than a technology, but there is a technical solution for this. Instead of generating custom method handlers at run time, precompile a pool of reconfigurable ones that are assigned as needed, essentially making the bridge process fully data-driven. As far as I know, this has not yet been done in RubyCocoa or MacRuby.
Another important thing to keep in mind is that the compiled Ruby and RubyCocoa runtimes can be significantly larger than the compiled Objective-C applications. If these libraries were available on the iPhone, that would not be a problem, but for now, even if you have RubyCocoa, you may not use it for the applications you distribute.
Tim Burks Nov 09 '08 at 0:04 2008-11-09 00:04
source share