views:

163

answers:

4

I don't really understand this article. But it sounds like you can compile C/C++ for flash. If that's possible, how hard would it be to compile and run Mono inside flash?

Sounds stupid I know...maybe I'm going crazy with my age.

+1  A: 

Probably is possible, at the first time, but just compile. Let me see if I got where you want go.

Mono can run on-the-fly code, but even now that there is a C# Shell it first compiles to IL (and maybe JIT) and after that it executes. With that technology will be possible to make Flash generate .NET assemblies, but not run them!

We will need a .NET IL to AS3 bytecode converter in order to run .NET assemblies in Flash. Probably you are thinking in this, right? But that's not crazy at all, it's compatibility!

Augusto Radtke
I think the OP is talking about porting Mono itself to run within LVVM, resulting in a CLR running within the AVM2.
Richard Szalay
True, you can't even compile as I remember the Mono csc.exe is in C#, you'll need the runtime first. But I doubt that could be easily ported because VMs are pretty optimized for specific architectures.
Augusto Radtke
+1  A: 

There's no reason you couldn't write a CLR in alchemy, but alchemy does not compile C to native code (it's compiled to bytecode) so it's going to be restricted both in performance and security in the same way as normal actionscript. Because of this, you'd probably need to rewrite alot of mono.

So in short: it's possible but you aren't going to win any performance awards.

Richard Szalay
Any links to this alchemy thing?
tyndall
http://labs.adobe.com/technologies/alchemy/
Richard Szalay
A: 

Alchemy uses LLVM to translate compiled C/C++ code into ActionScript. LLVM (http://www.llvm.org/) is a compiler infrastructure (ripped from that page's headline!) that supports compiling C/C++ to a low-level instruction set. You can build a virtual machine on top of it, analyze things about compiled code (like data flow or code coverage or whatever), and generally do all sorts of cool things.

I don't think you can use it to translate IL into flash though.

MSN
+5  A: 

I'm sure a really good and dedicated hacker, able to change both the mono runtime and the flash player, could get a trivial hello-world-like program to run in a few months of work. That said, implementing all the features would be either extremely complex or extremely slow, so, from a practical point of view using this approach wouldn't work.

If you'd like to run CLR-based managed code in the browser, check out the Moonlight 2.0 progress here: it works today, it is fast and it can be easily ported to run on a wide range of devices (there is also a Mono port to Android, for example).

lupus