为 JVM 编译 C++ [英] Compiling C++ for the JVM

查看:25
本文介绍了为 JVM 编译 C++的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在编译 C++ 时,您当然要为要编译的目标平台使用编译器.是否有针对 JVM 的 C++ 编译器(因此不是使用 Java本机"接口,而是将 C++ 代码编译为 Java 字节码)?

When compiling C++ you of course use a compiler for the target platform you want to compile for. Is there a C++ compiler that targets the JVM (so instead of using the Java "native" interface C++ code is compiled to Java byte code)?

推荐答案

NestedVM 为 Java 字节码提供二进制翻译.这是通过将 GCC 编译为 MIPS 二进制文件来完成的,然后将其转换为 Java 类文件.因此,任何用 C、C++、Fortran 或 GCC 支持的任何其他语言编写的应用程序都可以在 100% 纯 Java 中运行,而无需更改源代码.

NestedVM provides binary translation for Java Bytecode. This is done by having GCC compile to a MIPS binary which is then translated to a Java class file. Hence any application written in C, C++, Fortran, or any other language supported by GCC can be run in 100% pure Java with no source changes.

这篇关于为 JVM 编译 C++的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆