Jni, returning array from java to native
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Stefan_Keller
Posted On:   Tuesday, March 22, 2005 08:12 AM

Hi, in my application I need to do a lot af native stuff (serial port...) I have a problem with return a byte[] from a java method to the native code. The program esentially looks like this (pseudo code): //in java public byte[] method(){ return new byte[20]; } //in c jmethodID mid = (*env)->GetMethodID(env, cls, "method", ()[B); jbyteArray arr = (*env)->CallByteMethod(env, obj, mid); In the last line of the c code happens a huge error. I dont konw why. But there is a probably indicative warning when I compile the c program. "warning: Assignment makes pointer from integer without a cast" Does anybody has    More>>

Hi,

in my application I need to do a lot af native stuff (serial port...)
I have a problem with return a byte[] from a java method to the native code.
The program esentially looks like this (pseudo code):
//in java
public byte[] method(){
return new byte[20];
}

//in c
jmethodID mid = (*env)->GetMethodID(env, cls, "method", ()[B);
jbyteArray arr = (*env)->CallByteMethod(env, obj, mid);

In the last line of the c code happens a huge error. I dont konw why.
But there is a probably indicative warning when I compile the c program.
"warning: Assignment makes pointer from integer without a cast"


Does anybody has a clue why this is happing.
Has anybody done something like this before and give me sample code?

Thank you very much,
Stefan

   <<Less
About | Sitemap | Contact