有没有办法启动用托管语言编写的代码?

发布于 2024-11-15 11:44:58 字数 67 浏览 2 评论 0原文

这个问题说明了一切。我可以将 C# 编译为本机代码并启动它吗?我知道宇宙和奇点,但我想知道是否有更新的技术或工具。谢谢。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

帅冕 2024-11-22 11:44:58

显然你可以使用 Mono 编译为本机代码:

http://www.mono -project.com/Mono:Runtime#Ahead-of-time_compilation

不过,您将无法用它编写操作系统。用 C# 编写整个操作系统是不可能的,Cosmos 和 Singularity 将有部分不是托管代码。

或者,当然,您可以将代码设置为在 Windows 启动时启动 - 一旦 Windows 启动到登录屏幕及其他屏幕,.NET 应用程序就会正常运行。

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.

美人迟暮 2024-11-22 11:44:58

“启动它”到底是什么意思...如果你的意思是“在机器上作为操作系统启动”,你需要设置一个启动加载程序并自己重写大部分 c# 函数。您还必须使用较低级语言(汇编/c[++]/等)设置所有特定于机器的功能。基本上,如果不做大量的工作,就无法让它自行启动。

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.

唯憾梦倾城 2024-11-22 11:44:58

一种选择是创建一个设置为随系统启动的 Windows 服务。我相信还有其他方法可以实现这一点,但这可能是“最简单的”。

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'.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文