CNI namespace
Per Bothner
per@bothner.com
Sat Apr 1 00:00:00 GMT 2000
Paul Fisher <pnfisher@redhat.com> writes:
> Given "jarray foo", in CNI, foo->length is valid, in JNI it is not.
So? I'm not seeing the problem. In JNI, you use GetArrayLength.
> I need to deal with CNI and JNI jarrarys at the same time. That is, I
> need to be able to include both jni.h and cni.h and not have typedefs
> conflict.
They don't conflict! If they do, it's a bug in jni.h or cni.h,
since they both are part of libgcj
Is the problem they libgcj's cni.h conflicts with Sun's jni.h?
But I don't see why you want to include both of those at the same time.
I can see that you might want to write native code that can be
compiled either:
(a) portably, using any jni.h file, including either libgcj's or Sun's; or
(b) efficiently, using the cni.h interface.
We want to do this in a way that doesn't clutter up the source files
too much, so we may want to include jni.h even in case (b). But in that
case, you have to use the libgcj jni.h, not Sun's.
Again, I may be missing what you're trying to do.
(As suggested earlier, we could sacrifice some portability in favor of
simpler source files, by requiring the use of g++, but with a flag
to generate the JNI ABI. Then the binaries can be used with any
Java VM, but you need non-portable tools to generate the binaries.)
--
--Per Bothner
per@bothner.com http://www.bothner.com/~per/
More information about the Java
mailing list