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

Per Bothner bothner@cygnus.com
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/prims.cc.
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?

Yes.

	--Per Bothner
bothner@cygnus.com     http://www.cygnus.com/~bothner




More information about the Java mailing list