Linking C or C++ to gcj compiled .o files

Per Bothner
Sun May 2 10:31:00 GMT 1999

> As far as I can tell, CNI is an alternative to JNI.  What I want is
> something the other way round.  I want the main shell of a program to be
> written in C/C++, and to link it to some portions written in java.

It is possible, but not yet supported.   We should come up with something.
(This would be the equivalent to the JNI "invocation" API.)

I would start by looking at the JvRunMain function in libjava/
That is the glue function that gets invoced on start-up (C main), and
has the basic functionality you need (though you probably have to
change it some).

> Aside: The gcj frontend won't (apparently) compile inner classes.

Not yet.

> Am I right in thinking that if I compile .java --> .class using a compiler
> which does support inner classes (e.g. jikes) then I can compile .class
> --> .o using gcj?


	--Per Bothner

More information about the Java mailing list