is there a way to boot code written in a managed language?
The question says it all. Can I compile C# to native code and boot it? I know of Cosmos and Singularity, but I was wondering if there are more recent techniques开发者_运维百科 or tools. Thanks.
Apparently you can compile to native code using Mono:
http://www.mono-project.com/Mono:Runtime#Ahead-of-time_compilation
Still, you won't be able to write an OS with that. Its impossible to write an entire OS in C#, Cosmos and Singularity will have portions that aren't managed code.
Or of course, you can set your code to boot at Windows Startup - .NET applications will run just fine once Windows has booted up to the login screen and beyond.
What exactly do you mean by "boot it"... If you mean "boot on a machine as an OS" you would need to set up a bootloader and re-write most of the c# functions yourself. You would also have to set up all the machine-specific features from a lower-level language (assembly/c[++]/etc). Basically, there's no way to have it boot by itself without a significant amount of work.
One option would be to author a windows service that is set to start with the system. I believe there are other ways to accomplish this but this maybe 'the easiest'.
精彩评论