diff --git a/include/SDL3/SDL_system.h b/include/SDL3/SDL_system.h index e283233dc5..eee8ee2c54 100644 --- a/include/SDL3/SDL_system.h +++ b/include/SDL3/SDL_system.h @@ -261,6 +261,13 @@ extern SDL_DECLSPEC void SDLCALL SDL_SetiOSEventPump(bool enabled); /* * Platform specific functions for Android */ + +#if defined(__cplusplus) +typedef struct _JNIEnv JNIEnv; +#else +typedef const struct JNINativeInterface* JNIEnv; +#endif + #ifdef SDL_PLATFORM_ANDROID /** @@ -283,7 +290,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_SetiOSEventPump(bool enabled); * * \sa SDL_GetAndroidActivity */ -extern SDL_DECLSPEC void * SDLCALL SDL_GetAndroidJNIEnv(void); +extern SDL_DECLSPEC JNIEnv * SDLCALL SDL_GetAndroidJNIEnv(void); /** * Retrieve the Java instance of the Android activity class. diff --git a/src/core/SDL_core_unsupported.c b/src/core/SDL_core_unsupported.c index b36c7f7441..54fa095a85 100644 --- a/src/core/SDL_core_unsupported.c +++ b/src/core/SDL_core_unsupported.c @@ -146,8 +146,8 @@ const char *SDL_GetAndroidInternalStoragePath(void) return NULL; } -SDL_DECLSPEC void *SDLCALL SDL_GetAndroidJNIEnv(void); -void *SDL_GetAndroidJNIEnv(void) +SDL_DECLSPEC JNIEnv *SDLCALL SDL_GetAndroidJNIEnv(void); +JNIEnv *SDL_GetAndroidJNIEnv(void) { SDL_Unsupported(); return NULL; diff --git a/src/core/android/SDL_android.c b/src/core/android/SDL_android.c index 78d8b71941..7f8b56ee88 100644 --- a/src/core/android/SDL_android.c +++ b/src/core/android/SDL_android.c @@ -2177,7 +2177,7 @@ bool Android_JNI_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *b ////////////////////////////////////////////////////////////////////////////// */ -void *SDL_GetAndroidJNIEnv(void) +JNIEnv *SDL_GetAndroidJNIEnv(void) { return Android_JNI_GetEnv(); } diff --git a/src/dynapi/SDL_dynapi_procs.h b/src/dynapi/SDL_dynapi_procs.h index f308ce52ef..165de3c064 100644 --- a/src/dynapi/SDL_dynapi_procs.h +++ b/src/dynapi/SDL_dynapi_procs.h @@ -255,7 +255,7 @@ SDL_DYNAPI_PROC(const char*,SDL_GetAndroidCachePath,(void),(),return) SDL_DYNAPI_PROC(const char*,SDL_GetAndroidExternalStoragePath,(void),(),return) SDL_DYNAPI_PROC(Uint32,SDL_GetAndroidExternalStorageState,(void),(),return) SDL_DYNAPI_PROC(const char*,SDL_GetAndroidInternalStoragePath,(void),(),return) -SDL_DYNAPI_PROC(void*,SDL_GetAndroidJNIEnv,(void),(),return) +SDL_DYNAPI_PROC(JNIEnv*,SDL_GetAndroidJNIEnv,(void),(),return) SDL_DYNAPI_PROC(int,SDL_GetAndroidSDKVersion,(void),(),return) SDL_DYNAPI_PROC(const char*,SDL_GetAppMetadataProperty,(const char *a),(a),return) SDL_DYNAPI_PROC(SDL_AssertionHandler,SDL_GetAssertionHandler,(void **a),(a),return)