Wednesday, July 27, 2005

NoodleGlue - Bridging the divide between C++ and Java

What does it do ?
NoodleGlue is a system which generates the source code necessary to create Java "wrapper" files which mirror your C++ classes. The NoodleGlue generator applications create several types of source file, both Java and C++, which must be compiled along with your application. At runtime your application will use a runtime library which will be automatically loaded whenever you use one of the bridged classes.

Main Features
* Far quicker and more reliable than manually writing painful JNI code. Using NoodleGlue can save months of laborious and error prone coding - we do the tedious work for you.
* Much more complete and flexible than alternative wrapping technologies such as SWIG, and much more applicable to legacy code than GCJ.
* Almost all compatible features of C++ can be mirrored in Java, including templates, enums etc.
* References to Java objects may be passed to C++ code which can treat them exactly like a native C++ object (calling methods etc)
* C++ classes may be subclassed in Java, and used in C++ with complete flexibility - for instance a Java class may override a method of a C++ class, and the new object can be passed as a parameter to C++ code, which will use the overriding Java method.
* The inheritance hierarchy is maintained - even multiple inheritance of pure abstract classes in C++ is translated into multiple interface declarations in Java.
* Extremely low execution overhead - in most cases the code generated is much more efficient than hand generated code. There is virtually no overhead imposed upon objects above the unavoidable JNI code required when traversing from one language to the other.
* With C++ code that uses reference counting rather than manual deletion of objects (or can be adapted to do so) almost all memory management is automatic.
* Custom translation modules allow optimisations for very efficient bridging and caching of complex types.
* Optional automatic recognition of Java patterns such as "get" and "set" methods, which allows automatic enhancement of the code by adding support for Java conventions such as Property Change events etc.
* "HyperWrapping" allows additional methods to be added to the Java proxies without subclassing, and with no overhead.


An overview of NoodleGlue by Tree is also available in the July issue of CUJ.

1 comment:

Archana Raghupathy said...

nice to know about noodleglue.. have u used it?