Closed GoogleCodeExporter closed 8 years ago
Thanks for the patch! I will make sure to add this to the next release. I am
not sure if it's a good idea to call DetachCurrentThread() like that all the
time though, but then again, we might never get the chance to run on that
thread again to detach it so.. Some people seem to have issues with
DetachCurrentThread() on Android though:
http://groups.google.com/group/android-ndk/browse_thread/thread/d87f33e60acdaa3a
I guess I will try to do what Alan said in the last message of that thread...
Original comment by samuel.a...@gmail.com
on 14 Oct 2011 at 12:51
I made changes in the SVN repository. It should fix this issue. Can you check?
Thank you
Original comment by samuel.a...@gmail.com
on 20 Oct 2011 at 2:19
Finally got around to testing it. The detach problem was fixed. However, I had
to define _JavaVM under ANDROID to get it to compile.
Original comment by bid...@gmail.com
on 25 Oct 2011 at 2:07
What does your jni.h file look like?
Original comment by samuel.a...@gmail.com
on 26 Oct 2011 at 2:38
From the jni.h:
struct _JNIEnv;
struct _JavaVM;
typedef const struct JNINativeInterface* C_JNIEnv;
#if defined(__cplusplus)
typedef _JNIEnv JNIEnv;
typedef _JavaVM JavaVM;
#else
typedef const struct JNINativeInterface* JNIEnv;
typedef const struct JNIInvokeInterface* JavaVM;
#endif
...
/*
* C++ version.
*/
struct _JavaVM {
const struct JNIInvokeInterface* functions;
#if defined(__cplusplus)
jint DestroyJavaVM()
{ return functions->DestroyJavaVM(this); }
jint AttachCurrentThread(JNIEnv** p_env, void* thr_args)
{ return functions->AttachCurrentThread(this, p_env, thr_args); }
jint DetachCurrentThread()
{ return functions->DetachCurrentThread(this); }
jint GetEnv(void** env, jint version)
{ return functions->GetEnv(this, env, version); }
jint AttachCurrentThreadAsDaemon(JNIEnv** p_env, void* thr_args)
{ return functions->AttachCurrentThreadAsDaemon(this, p_env, thr_args); }
#endif /*__cplusplus*/
};
Original comment by bid...@gmail.com
on 26 Oct 2011 at 2:49
And “#ifdef _JavaVM“ returns false? What compiler/NDK version?
Original comment by samuel.a...@gmail.com
on 26 Oct 2011 at 2:54
Building this with NDK r6b. For API 10. Using the Windows SDK version
Original comment by bid...@gmail.com
on 26 Oct 2011 at 2:58
Hum, typedef should not work with #ifdef, I wonder why it seemed to work...
Anyway, I found a better way to handle this. I updated the SVN repo
accordingly, please test it out! thanks
Original comment by samuel.a...@gmail.com
on 26 Oct 2011 at 4:22
That worked. Thank you.
Original comment by bid...@gmail.com
on 26 Oct 2011 at 2:02
You are welcome!
Original comment by samuel.a...@gmail.com
on 29 Oct 2011 at 5:11
Original issue reported on code.google.com by
bid...@gmail.com
on 12 Oct 2011 at 7:06Attachments: