Zara wrote:
> andrea_ wrote:
>
>>I've got a problem: I must use an int java array in a C code. Using JNI
>>i wrote this code:
>>
>> jsize len = (*env)->GetArrayLength(env, payload); //payload is the
>>name of java array
>> jint *body = (*env)->GetIntArrayElements(env, payload, 0);
<snip>
>> input.data=(u_char)*body; //here there is the error
>>
>> the compiler says this:
>> warning: assignment makes pointer from integer without a cast
>>
>> P.S. data is define in this way:
>> u_char *data;
>
> The cast is wrong; write:
>
> input.data=(u_char *)body;
That will get rid of the warning and, assuming u_char is a typedef for
unsigned char is completely valid as far as C is concerned. However I
would suggest the OP ask somewhere where the JNI is on topic to see if
this is the right was to access a Java int array. Since the J in JNI
stands for Java I would suggest a group with java in the name, possible
comp.lang.java.programmer, but check *their* FAQ, charter and a load of
posts to see what goes on there before posting.
--
Flash Gordon
Living in interesting times.
Although my email address says spam, it is real and I read it.
|