Where to find a CNI-Tutorial?

Andrew Haley aph@redhat.com
Tue Aug 26 11:03:00 GMT 2003


Jeff Sturm writes:
 > On 2003年8月25日, Clemens Eisserer wrote:
 > > 1.) Does anybody know good tutorials for CNI?
 > > The only tutorials I read where not really helpful, because they mostly
 > > coverd how to access java from c, not how to access c from java.
 > 
 > Native methods in CNI are C++, so they can call other C/C++ code. If
 > you're accessing C code, the headers will have to be C++-safe.
 > 
 > Post an example if you're stuck.
 > 
 > > 2.) Is there a platform-independent way to store pointer-values in java
 > > variables using CNI. With JNI this isnt possible as far as I know,
 > > because storing pointer-values into "int" only works of cource on 32-bit
 > > machines.
 > 
 > That's what gnu.gcj.RawData is for.
Following my experience with SWT, I can only advise people not to do
this if at all possible. Better to do everything that requires
handling pointers in C++ and use a layer that isolates them in opaque
structures.
Andrew.


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /