JNI++

Java/C++ subclassing

JNI++ Project: Objectives and Aims last update: June 12. 2000 14:30
JNI++ Generator I: Input, Java Proxies, JNI Stubs last update: June 12. 2000 14:30
JNI++ Generator II: JNI++ Adapter Classes last update: June 12. 2000 14:30
JNI++ Generator III: Java/C++ Type Conversions (under development) last update: June 12. 2000 14:30
JNI++ Open Source: Download NT (revised version with inline doc) last update: April 26. 2000 19:22
JNI++ Open Source: Download Solaris last update: June 13. 2000 11:25
JNI++ Open Source: Download Linux last update: May 16. 2000 16:00
Example: Online Documentation last update: June 14. 2000 09:30
Example: HTMLHelp download last update: June 14. 2000 09:30
You are visitor number Klaus Wiederänders

CALL FOR COLLABORATION!

Dear Javaers,

from several forums I realized that it seems to be a quite common task to re-use existing C++ object libraries from Java.

There is documentation about how to do such a thing with JNI. Furthermore, Rob Gordon's book "Essential JNI" contains a chapter named "Java and C++" as well as one with title "Conversion of C Structures". The downloadable accompanying software contains a tool called structConverter for translation of C structures to Java JNI. This is a good starting point, but...

... all this tells only one half of the story. It serves quite well in calling C++ libraries from Java using JNI. Unfortunately, it does not tell much about how to handle callbacks (i.e. virtual functions). The aim, however, should be to allow full Java subclassing of C++ superclasses including overriding virtual C++ functions by Java methods.

... the tools are related to C instead of C++. What one needs is a generator which parses C++ class definitions and creates the corresponding Java proxies, JNI C++ code, and C++ adapter classes on the fly. All this with full support of Java/C++ type conversion.

Since I didn't find something fitting with these aims, I would like

  • to know if there is an open-source project around already dealing with full Java/C++ subclassing
  • to announce a open-source project called JNI++, if none.
This is the JNI++ homepage. It provides several downloads for different platforms. Each download contains the same simple example demonstrating the JNI++ approach to subclassing. Though this example is really very simple, it shows the difficulties to be faced in Java/C++ subclassing. And it outlines how these problems can be conquered by a generator for all that wrapper code. Furthermore, there are a handful of papers which describe the JNI++ approach and the example in some detail. 

Now for a really big problem: As it goes for the most of us, I'm not in the position to attach enough working power to JNI++ as would be necessary to make it running soon. It would be really nice if someone joins or even co-founds this project. That is at least for two reasons: joining the brains and sharing the efforts. Everybody and everything is welcome...

Looking forward to your comments,

Klaus

1