Skip to content

SDL_Android_Init and SDL_SetMainReady not exposed #670

Open
@tanis2000

Description

@tanis2000

I'm trying to build a project using SDL2 that can compile on both iOS and Android.
While iOS is pretty straightforward and works fine just by compiling the static SDL2 libraries from their own Xcode iOS project, the Android project has to be tweaked to integrate with user code.

This lead me to having to create an Android library to compile the C sources of SDL2 but omitting the SDL_android_main.c as that would require SDL_main to be defined inside the SDL2 library itself which is something I need to avoid.

The solution I came up with is to just skip that SDL_android_main.c file and reimplement the JNIEXPORT int JNICALL Java_org_libsdl_app_SDLActivity_nativeInit(JNIEnv* env, jclass cls, jobject array) function in Rust.

The problem is that the function needs both SDL_Android_Init and SDL_SetMainReady to be exposed as I need to call them before calling my own SDL_main.

Can they be exposed or am I asking for trouble? Have you got any idea of a different approach in case this is not the right path to follow? (Sorry but I'm new to Rust and there are still many moving parts of the whole toolchain that I do not know).
Cheers!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions