Hi,

I just looked at the differences between the java.util.zip implementation
of libgcj with CNI and the version that Jochen Hoenicke made with JNI. 
<http://www.Informatik.Uni-Oldenburg.DE/~delwi/classpath/JCL/>

Since I know nothing of CNI or JNI I will need to learn a bit more about it.
But I thought that it might be a good idea to tell you my first impressions
so people can correct me when I am wrong.

CNI is readable and JNI is not. This might be because the Perl script that
Jochen made inserts a bit more casts and JNI functions then necessary.

With CNI a reference to gnu.gcj.RawData is used to hold data that the native
code needs. With JNI a reference to a byte[] is used. It seems that a
reference to RawData will not be touched by the Garbage collector. I am not
sure why that is necessary in this case.

The CNI version does all Nullpointer and array bounds checking in native
code. The JNI version does all that checking in java. I am not sure why
you would want to do that checking in native code in this case.
I like the JNI version more since that does all the sanity checking in
a java wrapper and then hands of the checked data to the native code.

The CNI version seems to synchronize all the native calls, the JNI version
does not. That is how I interpret the first line of every CNI function:
JvSynchronize sync (this);

OK, thanks for listening. 
I am now going to look up some real documentation of JNI and CNI.

Cheers,

Mark

P.S. How was the C++ wrapper library approach of Paul Fisher supposed to work?

Reply via email to