多语言开发
我想用两种语言开发一个应用程序。 实际上,目标是生成两个不同的应用程序,一个使用一种语言 (Java),另一个使用另一种语言 (C#)。
由于目标定义,我想使用 makefile 来帮助我生成一个应用程序或另一个应用程序。
我不知道从哪里开始。 你有尝试过这样的发展吗? 是否可以使用一个 makefile 来调用使用不同目标的 java 编译器或 c# 编译器?
预先感谢您的帮助。
I would like to develop an application with two languages.
Actually, the goal is to generate two differents application, one with a language (Java), the other on in another language (C#).
I would like to use makefiles to help me generate one application or the other one, thanks to targets definition.
I don't know where to begin.
Have you ever try to develop like this ?
Is it possible to use one makefile to call java compiler or c# compiler using different targets ?
Thanks in advance for your help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
当然,您可以使用 make 文件来编译(和链接)不同语言的源文件。没有限制。您所需要的只是一个可以由 shell/从命令行调用的编译器(链接器)。
替代方案:ant 可以同时执行 Java 和 C#。如果您不需要使用单个构建文件构建两个应用程序,您仍然可以使用单独的文件并编写批处理/shell 脚本来调用两个构建器。
Sure, you can use a make file to compile (and link) source files for different languages. There's no limitation. All you need is a compiler (linker) that can be called by a shell / from a command line.
Alternatives: ant can do both Java and C#. If you don't need to build both applications with a single build file, you still can use separate files and write a batch/shell script to call both builders.
是的,可以覆盖 Makefile 变量以指向 javac 或 .NET 编译器。
然而,您很可能不会从中受益,因为编写在两种语言中都有效的程序非常困难。
您可能需要查看 http://www.ikvm.net/,它在 . NET,因此如果您有 Java 程序,它可以在 .NET 下运行。
Yes it is possible to override a Makefile variable to point to either javac or the .NET compiler.
You will, however, most likely not benefit from this as it is very hard to write a program that is valid in both languages.
You may want to look into http://www.ikvm.net/ which provides a Java emulation environment under .NET, so if you have a Java program it can run under .NET.
还有 Fantom 项目,它声称可以做到这一点,但我对跨平台支持抱有强烈的怀疑(你怎么能抽象出所有 API 的所有副作用?)。
但我不了解这个项目,也许他们做得很好。
http://fantom.org/
There is also the Fantom project, which claims to do that, but I have strong doubts regarding cross-platform support (how can you abstract all side-effects of all APIs?).
But I don't know the project, maybe they do a fine job.
http://fantom.org/
我的想法很愚蠢,但我想你可以尝试这个:
第一步:制作bat文件
步骤2:制作2个脚本文件
第3步:让它执行它们!
这个想法会失败
my idea is pretty dumb but i guess you could try this:
step 1: make a bat file
step 2: make the 2 script files
step 3: make it so it executes both of them!
this idea is gonna fail