Will cni be the sane native interface to c++ in openjdk U gcj?

Glenn Chambers gchamber@bright.net
Tue Dec 25 20:57:00 GMT 2007


On Tue, 2007-12-25 at 16:49 +0000, Andrew Haley wrote:

> Mmm, I think you are right.  C++ code either throws Java exceptions or
> C++ exceptions, but not both.  I failed proprtly to read what you
> wrote.

The most interesting question to me isn't what it throws, but what
it can catch.

If I can write this in a Java CNI implementation function, then I'm
happy:

void myJavaClass::NativeMethod(int parameter)
{
try {
nativeCPPLibrary::globalFunction();
} catch (nativeCPPLibrary::myException x) {
throw new myJavaException(x.failCode);
}
}

In the 3.0 version I was playing with, this code was illegal.  In fact,
referring to both C++ exceptions and Java exceptions in the same object
file failed.




More information about the Java mailing list