JNI usage

A

Arinté

We have some old code that I am taking over and we have this.

JNIEXPORT jint JNICALL
Java_com_ibm_jusb_os_windows_JavaxUsb_submitControlPipeRequest
(JNIEnv *env, ..., jbyteArray buffer, ... )
{
....
output = (*env)->GetByteArrayElements(env, jbOutBuffer, 0);//Get the
pointer to jbyteArray
....

}


Is it necessary to call
if(output) (*env)->ReleaseByteArrayElements(env, jbOutBuffer, output, 0);
 
G

Gordon Beaton

output = (*env)->GetByteArrayElements(env, jbOutBuffer, 0);
[...]

Is it necessary to call
if(output) (*env)->ReleaseByteArrayElements(env, jbOutBuffer, output, 0);

Yes.

/gordon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

JNI 1
AIX JNI Link with G++ module Problem 0
ReleaseByteArrayElements fails 0
JNI and GetFieldID 12
JNI and pointer deletion 2
Problem with JNI 7
JNI Access Violation in jvm.dll 5
JNI Invocation API example 4

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,143
Latest member
DewittMill
Top