Is it viable to make a port from a C++ application to Java through LLVM

Posted by Javier Mr on Programmers See other posts from Programmers or by Javier Mr
Published on 2013-10-30T08:52:45Z Indexed on 2013/10/30 10:18 UTC
Read the original article Hit count: 221

Filed under:
|
|

how viable is it to port a C++ application to Java bytecode using LLVM (I guess LLJVM)?

The thing is that we currently have a process written in C++ but a new client has made mandatory to been able to run the program in a multiplatform way, using the Java Virtual Machine with obviously no native code (no JNI). The idea is to be able to take the generated jar and copy then to different systems (Linux, Win, 32 bits - 64 bits) and it should just work.

Looking around looks like it is possible to compile C++ to LLVM IR code and then that code to java bytecode. There is no need of the generated code to be readable.

I have test a bit with similar things using emscripten, this takes C++ code and compile it to JavaScript. The result is valid JS but totally unreadable (looks like assambler).

  • Does anybody done a port of an application from C++ to Java bytecode using this tecnique?
  • What problems could we face?
  • Is a valid approach for production code?

Note: I am aware that currently we have some non standard C++ and close source libraries, we are looking to removing this non standard code and all close source libraries and use Free Libre Open Source Software, so lets suppose all code is standard C++ code with all code available at compile time.

Note: It is not an option to write portable C++ code and then compile it to the desired target platform, the compiled program must be mltiplatform thus the use of JVM (right now we are not looking in similar solutions but Python or other language base, but i would also like to heard about it)

© Programmers or respective owner

Related posts about java

Related posts about c++