Jump to content
Excelsior Forums


  • Content count

  • Joined

  • Last visited


Community Reputation

0 Neutral

About powpow

  • Rank
  • Birthday 01/01/1
  1. powpow

    JET's Bug When use JNI....

    HI,I must explain my codes test all right on SUN JVM ,so my codes has no error. char* outbuf = (char*) env->GetIntArrayElements(jbuffer, NULL); this code just get the int array first memory address,it can write void* outbuf,int* outbuf too,not wrong here.If I change it to int* outbuf ,the error is also exists. for (int i =0 ;i<512*512; i++) // the image buffer is 512 * 512 { outbuf[i] = 0x00ff0000; //(R=255 G=0 B=0 indicates it's a red image ) } this code i write wrong,i just express 'do some change on outbuf'...Sorry about it! I also send int array length to C/C++ side .So I Can do change on outbuf.
  2. powpow

    JET's Bug When use JNI....

    2) I have released the int array by call ReleaseIntArrayElements method,just not paste in. It's All Test right in Sun JVM the same codes, and if use byte[] array(C/C++ side jbyteArray),Excelsior JET is right too. but not well when use int[] array.
  3. powpow

    JET's Bug When use JNI....

    The whole context is below: 1: On the Java Side I use a int[] array (int[] javaSideImageData)in order to store a image pixel buffer.I use the javaSideImageData to display my image in java rich client. 2: On the JNI C/C++ Side, there are corresponding jintarray (jintArray jbuffer) data structure refer to int[] array (int[] javaSideImageData) on the java side. when the operations starts (Using JET mode), the JNI C/C++ side write to the pixel buffer the correct image data . Code segment are : char* outbuf = (char*) env->GetIntArrayElements(jbuffer, JNI_FALSE); *** wirte my image data to outbuf *** for example the outbuf array's contents are RGBA RGBA RGBA .... ,which contains 512*512 pixels. But actually After writing the outbuf successfully,the javaSideImageData array element are all zero.That's not I needed. On the contrary(Using the SUN JVM), the javaSideImageData array element are all I needed. I think this is a JET's bug! Everyone interested on it can write a jni example like this(not very completed): Java code: public class imageTest { public void setImageBuffer(int[] javaSideImageData); } JNI C/C++ Code: void (packagename)_setImageBuffer(jintarray jbuffer) { char* outbuf = (char*) env->GetIntArrayElements(jbuffer, JNI_FALSE); for (int i =0 ;i<512*512; i++) // the image buffer is 512 * 512 { outbuf = 0x00ff0000; //(R=255 G=0 B=0 indicates it's a red image ) } } then on the java side image buffer element are all zero using JET compilation. Could you tell me why Or anybody can solve this problem? Thank you first!
  4. powpow

    JET's Bug When use JNI....

    by the way , if it is a byte array ,is right in JET.
  5. powpow

    JET's Bug When use JNI....

    1、define a int array in java Class。 public Class NativeTestClass{ private int[] ints; public native void changeInts(); } 2、changeInts use JNI to change value of ints。(in C++ native Code ,Can get the point of this Object,then can change the value). 3、printf the ints ,it's right in sun standard jdk ,but all 0x00000000 in JET Compiled。 do i explain clearly?Sorry My English is so poor ,i'm chinese.
  6. My Java Application Use JNI to visite C/C++ dll。And in C/C++ Codes I Get the point of Java Object ,then I Use C/C++ Codes Operater and Return A int[] Variable。 It Can work ok when use standard Jdk ,but use JET to Compile I Get int[] all 0x00000000 。 who can tell me why?