Bug 17831 - GCJ/CNI should be usable without 'gcjh'
Summary: GCJ/CNI should be usable without 'gcjh'
Alias: None
Product: gcc
Classification: Unclassified
Component: java (show other bugs)
Version: unknown
: P3 enhancement
Target Milestone: ---
Assignee: Not yet assigned to anyone
Depends on:
Reported: 2004-10-04 23:36 UTC by Casey Marshall
Modified: 2016-09-30 22:51 UTC (History)
2 users (show)

See Also:
Known to work:
Known to fail:
Last reconfirmed: 2005-09-30 05:30:47


Note You need to log in before you can comment on or make changes to this bug.
Description Casey Marshall 2004-10-04 23:36:49 UTC
A nice enhancement to GCJ would be to remove the need to invoke 'gcjh' on
compliled classes before compiling CNI C++ source. Extending this to JNI code
would be nice, too, but potentially harder.

That is, the following command line should work:

   $ gcj -shared -o lib-foo.so foo.java foo.cc

Or, even this exact sequence:

   $ gcj -c -o foo.o foo.java
   $ gcj -c -o foo-cni.o foo.cc
   $ gcj -shared -o lib-foo.so foo.o foo-cni.o

In theory this should be possible, since everything you need to compile to
'lib-foo.so' is present in those two files. But in practice, of course, this
touches potentially everything from g++ to cpp, and becomes pretty hairy indeed.

Maybe a good way to do this would be to extend cpp so front-ends can register
hooks to the include-lookups, so gcj could, for example, intercept certain
#includes to produce CNI headers on-the-fly.

Also, gcj/gcjh should be able to generate CNI/JNI headers from java source. gcjx
can (will be able to) do this, for example.
Comment 1 Andrew Pinski 2004-10-04 23:38:59 UTC
Well the easy way to do this is to create the headers while compiling, aka combine gcj and gcjh like gcjx 
Comment 2 Casey Marshall 2004-10-07 01:11:40 UTC
Yes, but gcj doesn't have this feature currently, and gcjh only works with
bytecode. In the least it should work with java source, too.

In my opinion being able to generate CNI headers along with the compilation step
would be invaluable in itself.
Comment 3 Andrew Pinski 2016-09-30 22:51:11 UTC
Closing as won't fix as the Java front-end has been removed from the trunk.