Hi.
Im making an inerface to a DLL library, so i can use it with Java.
I need my native function to modify the value of a jlong parameter. Like the parameter was passed by reference.
My Java method must have the exact parameters as the native function MPUSBWrite shown down here.
Example of actual not working code:
The MPUSBWrite gets its 4th parameter as reference and modify itrs value.
I always get 0 when i read the pLength passed variable.
Java:
public static native boolean Write(long handle, byte[] pData, int dwLen, long pLength, int dwMilliseconds);
Native C++:
JNIEXPORT jboolean JNICALL Java_jPicUsb_iface_Write
(JNIEnv *env, jclass jc, jlong handle, jbyteArray pData, jint dwLen, jlong pLength, jint dwMilliseconds) {
jniByteArray b(env, pData);
DWORD res = MPUSBWrite((HANDLE)handle,b.getBytes(),dwLen,(PDWORD)pLength,dwMilliseconds);
if (res) {
return JNI_TRUE;
} else {
return JNI_FALSE;
}
}
Is there a way my C++ code modify the value of the pLength variable by reference?
Thanks!