This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


On Tue, 2007-12-25 at 15:57 -0500, Glenn Chambers wrote:
> 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.
> 
> 
swig (using >= 1.3.31) provides this with a java proxy wrapping
nativeCPPLibrary::myException as myJavaException subclassed from
java.lang.Exception, and jni code to do just the above. This is very
much one of the complex contortions in using jni.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]