Search code examples
monogoogle-nativeclient

Are there any examples of compiling C# code using Mono so that the exe can run with Google's native client support?


I have found a press release that states that Mono now support compilation for native client. It's unclear whether this is only available from the separate github mono fork, or as part of the standard distribution.

I've built the forked mono distribution, but I have been unable to find any examples on how to build a native client executable so that I can run it in Chrome.

Is anyone aware of an example project, or can you provide an example for how to build a Mono application for NaCl?


Solution

  • I think some of the changes may have been upstreamed, but as of today (11/16/11) there are definitely bugfixes that are still only in the github fork ( https://github.com/elijahtaylor/mono/ ). To build mono for nacl, follow the instructions in the mono/nacl directory ( https://github.com/elijahtaylor/mono/tree/master/nacl ). You want the mono runtime, which will build a mono which can be embedded in your nacl module and can JIT-compile .NET assemblies. (There is also a mono AOT compiler which runs on linux/mac and generates nacl modules, but I'm pretty sure it doesn't work right now, as nobody is using or testing it).

    See nacl/test/my.c and mono/mini/fsacheck.c for examples of how to call the mono runtime to JIT code from your nacl module. Inside the browser you'll have to come up with your own way (e.g. pepper and/or nacl-mounts) to get the bytcode into your nacl module.