I have a function with this signature from the header file
SIMAPI_DECL DWORD WINAPI SimReadDwordBuffer (DWORD* pBuffer,
DWORD dwDwordsToRead,
DWORD* pdwDwordsRead,
DWORD dwBlockDwords,
DWORD dwNoWait);
With the following native call defined
protected native int SimReadDwordBuffer (int[] pBuffer,
int dwDwordsToRead,
int pdwDwordsRead,
int dwBlockDwords,
int dwNoWait);
I use javah.exe to create the jni header and it looks like this
protected native int SimReadDwordBuffer (int[] pBuffer,
int dwDwordsToRead,
int pdwDwordsRead,
int dwBlockDwords,
int dwNoWait);
And the implementation is this
JNIEXPORT jint JNICALL Java_com_sig_ccm_CcmBase_SimReadDwordBuffer
(JNIEnv *env, jobject obj, jintArray pBuffer, jint dwWordsToRead,
jint pdwWordsRead,
jint dwBlockWords, jint dwNoWait){
jint *body = env->GetIntArrayElements(pBuffer, 0);
//DWORD foo = 0;
jint value = SimReadDwordBuffer((unsigned long int *)body,
dwWordsToRead,
//&foo,
(unsigned long int *)&pdwWordsRead,
dwBlockWords,
dwNoWait );
//cout << foo;
env->ReleaseIntArrayElements(pBuffer, body, 0);
return value;
}
The problem is no matter what I have tried I cannot get the value pdwWordsRead copied to the parameter I passed from java to jni. If I use a local variable I can write out the value so the c++ function is passing it back. Any suggestions would be appreciated.