Files
commandergenius/alienblaster/project/jni/sdl_main/sdl_main.c
pelya 94df8e2921 Fixed Alien Blaster not working on simulation - I've added lot of debug spam, it should be removed.
The problem is in the least obvious place - the std::ostringstream output deadlocks for no reason -
see file project/jni/application/src/asstring.h.
The only reason I can think of is that previously I've has one big statically linked library,
and now libstlport and libapplication areseparate shared libraries. But why then all std::vectors etc work?
2010-05-12 19:49:48 +03:00

48 lines
1.1 KiB
C

#ifdef ANDROID
#include <unistd.h>
#include <jni.h>
#include <android/log.h>
#include "SDL_thread.h"
#include "SDL_main.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