Fedora 16 上的 D 编程
我最近安装了 Fedora 16(非常棒),主要是因为我想尝试 LDC2,但也因为 Gnome Shell 在 Fedora 上运行比 Ubuntu 11.10 流畅得多(至少在我的硬件上)。
LDC2 工作得很好,但我想知道通过输出 LLVM .ll/.bc 代码,我是否可以在 Windows/Mac/Android 上编译并运行该应用程序。我可以使用 LLVM 在我的 Windows 计算机上将 .ll/.bc 文件编译为 ASM .s。然而,我第一次尝试编译 ASM 时出现错误:“未找到'main'函数。”。通过 ASM,我确实看到了一个 _Dmain 函数。我之前没有编译 ASM 的经验,所以我有点迷失。
我知道 DRuntime 在这里发挥作用,但有关 LDC2 DRuntime 平台支持状态的最新信息很少。所以我想知道我的选择是什么。 LDC2 现在可以编译 Windows 代码吗?目前是否支持任何其他平台/架构的交叉编译?
那么GDC呢?我想尝试 GDC,但我在 Fedora 软件中心找不到它,而且我对 Linux 还不太熟悉,所以从源代码构建它时遇到了困难。
D(版本 2)是我最喜欢的语言(其次是 C#),我期待有一天我可以用 D 编写游戏/应用程序,而不必担心硬件或平台支持。我支持这门语言,并希望开源社区将来能够大力拥抱 D。它确实是我所见过的功能、性能和生产力的最佳平衡。
I've recently installed Fedora 16 (which is great), mostly because I wanted to try LDC2 but also because Gnome Shell runs much smoother on Fedora than Ubuntu 11.10 (at least on my hardware).
LDC2 works great, but I'm wondering if, by outputting LLVM .ll/.bc code, I can compile AND RUN the application on Windows/Mac/Android. I can compile .ll/.bc files to a ASM .s on my Windows machine with LLVM. However, my first attempts at compiling the ASM gives me the error: "'main' functions not found.". Looking through the ASM I do see a _Dmain function. I have no prior experience compiling ASM so I'm a bit lost.
I understand DRuntime comes into play here, but up-to-date information on the state of LDC2's DRuntime platform support is scarce. So I'm wondering what my options are here. Can LDC2 compile code for Windows at this point? Is cross-compiling for any other platform/architecture supported at this time?
What about GDC? I'd like to try GDC but I can't find it on the Fedora Software Center, and I'm a bit new to Linux so I'm having difficulties building it from source.
D (version 2) is my favorite language (C# at second), and I'm looking forward to the day I can write games/apps in D without having to worry about hardware or platform support. I'm rooting for the language and I hope the Open Source community embraces D strongly in the future. It truly is the best balance of power, performance, and productivity I've ever seen.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
标准库和语言运行时有大量根据当前平台进行条件编译的代码,所以没有。
The standard library and language runtime have plenty of code conditionally-compiled depending on the current platform, so no.
不。不仅仅是因为运行时差异。请阅读 http://llvm.org/docs/FAQ.html#platformindependent 。虽然它是面向 C/C++ 的,但仍然有很多东西也适用于 D。
No. Not only due to runtime differences. Read http://llvm.org/docs/FAQ.html#platformindependent . Though it's C/C++ oriented, but still many things apply to D as well.
编译 GDC 非常简单。只需仔细阅读说明即可。
剩下的已经说了。平台无关性是通过 D 级别的条件编译实现的,因此位码也是平台相关的。
Compiling GDC is straightforward. Just read the instructions thoroughly.
The rest has already been said. Platform-independence is achieved via conditional compilation at the D level so the bitcode is also platform-dependent.