diff --git a/sal/inc/sal/main.h b/sal/inc/sal/main.h index ffe34d4a0a6e..bf1d2d3ef477 100644 --- a/sal/inc/sal/main.h +++ b/sal/inc/sal/main.h @@ -117,6 +117,54 @@ static int sal_main(void); @end +#elif defined ANDROID + +#ifdef __cplusplus +extern "C" { +#endif +#include +#ifdef __cplusplus +} +#endif + +#define SAL_MAIN_WITH_ARGS_IMPL \ +static int sal_main_with_args(int argc, char **argv); \ +\ +void android_main(struct android_app *state) \ +{ \ + int argc = 0; \ + char **argv = { NULL }; \ +\ + (void) state; \ +\ + /* Make sure glue isn't stripped. */ \ + app_dummy(); \ +\ + sal_detail_initialize(argc, argv); \ + sal_main_with_args(argc, argv); \ + sal_detail_deinitialize(); \ +} + +#define SAL_MAIN_IMPL \ +static int sal_main(void); \ +\ +void android_main(struct android_app *state) \ +{ \ + int argc = 0; \ + char **argv = { NULL }; \ +\ + (void) state; \ +\ + /* Make sure glue isn't stripped. */ \ + app_dummy(); \ +\ + sal_detail_initialize(argc, argv); \ + sal_main(); \ + sal_detail_deinitialize(); \ +} + +#define SAL_MAIN_WITH_GUI_IMPL SAL_MAIN_IMPL + #else #define SAL_MAIN_WITH_ARGS_IMPL \