Converted all libs from shared to static - it will allow closed-source apps to use LGPL-ed libsdl,
and will solve some cross-referencing problems, like SDL_init called from static constructors.
This commit is contained in:
@@ -103,4 +103,51 @@ extern DECLSPEC void SDLCALL SDL_InitQuickDraw(struct QDGlobals *the_qd);
|
||||
|
||||
#endif /* Need to redefine main()? */
|
||||
|
||||
#ifdef ANDROID
|
||||
|
||||
#include <unistd.h>
|
||||
#include <jni.h>
|
||||
#include "SDL_thread.h"
|
||||
|
||||
/* JNI-C wrapper stuff */
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define C_LINKAGE "C"
|
||||
#else
|
||||
#define C_LINKAGE
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
extern C_LINKAGE int main( int argc, char ** argv );
|
||||
static int SDLCALL MainThreadWrapper(void * dummy)
|
||||
{
|
||||
int argc = 1;
|
||||
char * argv[] = { "sdl" };
|
||||
chdir(SDL_CURDIR_PATH);
|
||||
return main( argc, argv );
|
||||
};
|
||||
|
||||
#ifndef SDL_JAVA_PACKAGE_PATH
|
||||
#error You have to define SDL_JAVA_PACKAGE_PATH to your package path with dots replaced with underscores, for example "com_example_SanAngeles"
|
||||
#endif
|
||||
#define JAVA_EXPORT_NAME2(name,package) Java_##package##_##name
|
||||
#define JAVA_EXPORT_NAME1(name,package) JAVA_EXPORT_NAME2(name,package)
|
||||
#define JAVA_EXPORT_NAME(name) JAVA_EXPORT_NAME1(name,SDL_JAVA_PACKAGE_PATH)
|
||||
|
||||
extern C_LINKAGE SDL_Thread * SDL_mainThread;
|
||||
|
||||
extern C_LINKAGE void
|
||||
JAVA_EXPORT_NAME(DemoRenderer_nativeInit) ( JNIEnv* env, jobject thiz )
|
||||
{
|
||||
SDL_mainThread = SDL_CreateThread( MainThreadWrapper, NULL );
|
||||
}
|
||||
|
||||
#undef JAVA_EXPORT_NAME
|
||||
#undef JAVA_EXPORT_NAME1
|
||||
#undef JAVA_EXPORT_NAME2
|
||||
#undef C_LINKAGE
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* _SDL_main_h */
|
||||
|
||||
Reference in New Issue
Block a user