more doc needed?

Nic Ferrier nferrier@tapsellferrier.co.uk
Mon Jul 22 14:59:00 GMT 2002


I've just come to write a bit of native code and realised that I
don't actually know how to do the integration and it doesn't seem to
be documented anywhere.
I think we need something like the following in the CNI manual, it's
an example of how to do Java/C++ CNI integration.
>>>> example >>>>>
1. save the following file as Test.java:
public class Test
{
 private native void native0 ();
 public void nonNative ()
 {
 native0();
 }
}
2. Then compile it:
 gcj -C -d . Test.java
and generate the header:
gcjh --classpath . Test
3. edit the Test.cc file and fill in the blanks.
4. Now compile the Test.cc file ??????
5. And now cause Test.java to load Test.cc? eg:
public class Test
{
 static
 {
 System.loadLibrary("Test");
 }
 private native void native0 ();
 public void nonNative ()
 {
 native0();
 }
}
Be sure to set LD_LIBRARY_PATH to the lib location of Test when
running the java code.
<<<<
If someone tells me the sort of g++ line I need I'll flesh this out and
add a section to the CNI manual.
Nic


More information about the Java mailing list

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