From 4adc27e9bf581b4f5edd148e12d7c344381d0f46 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Sat, 12 Jun 2021 16:50:21 +0000 Subject: [PATCH] Do not cast JavaEnv to void** for AttachCurrentThread on Android --- java_strings.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/java_strings.py b/java_strings.py index e00f513f..3d5a2a01 100644 --- a/java_strings.py +++ b/java_strings.py @@ -457,7 +457,10 @@ import java.util.Arrays; res = "JNIEnv *env;\n" res += "jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);\n" res += "if (get_jenv_res == JNI_EDETACHED) {\n" - res += "\tDO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);\n" + if self.target == Target.ANDROID: + res += "\tDO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, &env, NULL) == JNI_OK);\n" + else: + res += "\tDO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);\n" res += "} else {\n" res += "\tDO_ASSERT(get_jenv_res == JNI_OK);\n" res += "}\n" -- 2.39.5