Boris,

  This is not really the right list for this question, since it isn't
specifically about java on Linux.  You might be better off sending questions
like this to a more general java list.  But you want to look at using the
"GetLongArrayElements" and "ReleaseArrayElements" functions in your C code.  I
think it goes something like this:

JNIEXPORT void JNICALL Java_call_aug(JNIEnv *env, jopject obj, jlongArray a) 
{
 long* array_in_c = (*env)->GetLongArrayElements(env, a, 4); /* assuming length
of 4 */

 /* Do whatever you want to array_in_c */

 (*env)->ReleaseArrayElements(env, a, 0);

}
cheers,
Rich

Boris wrote:
> 
> hello,
> I meet a question in passing argments between java and c.
> In my java program,I call a method in a .dll file and pass a array to it.
> In the .h file that generated by javah,function declaration is followling:
> JNIEXPORT void JNICALL Java_call_aug
>   (JNIEnv *, jobject, jlongArray);
> 
> I write the following in my c file:
>  JNIEXPORT void JNICALL Java_call_aug
>   (JNIEnv *env, jobject obj, jlongArray a)
> {
> a[0]=1;
> }
> 
> when I build it by vc++,vc++ show the fllowing:
> D:\Boris\args\argdll\arg.cpp(26) : error C2679: binary '=' : no operator defined 
>which
> takes a right-hand operand of type 'const int' (or there is no acceptable conversion)
> 
> error line is a[0]=1;
> 
> How can I pass array ?Or,if I want pass data and want them changed in c ,then
> return,how can i do?
> Thanks
> Boris :-)
> 
> ----------------------------------------------------------------------
> To UNSUBSCRIBE, email to [EMAIL PROTECTED]
> with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]


----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to