Can gcj cross compile C / C++ programs into java byte code?

Jeff Sturm jsturm@one-point.com
Fri Aug 31 09:04:00 GMT 2001


On Fri, 31 Aug 2001, Johan Walles wrote:
> I've read the FAQ at " http://gcc.gnu.org/java/faq.html" ;, but the 
> question isn't answered there.  Can gcj cross compile C / C++ programs 
> into java byte code?  Why (not)?

No.  Gcj can do any of:

java source -> java bytecode
java source -> native object
java bytecode -> native object

It doesn't understand C/C++ syntax at all.  I suppose one could consider
implementing -femit-class-files on the c++ frontend, though I suspect
mapping the trees to legal java bytecode could be exceedingly difficult.
Java bytecode is really poorly suited to be a general-purpose IR.

Jeff



More information about the Gcc mailing list