Re: [sdljava-users] initial attempt to build sdljava under osx
Status: Beta
Brought to you by:
ivan_ganza
From: Rainer K. <ar...@gm...> - 2005-03-20 20:43:49
|
> Hello all, > I've tweaked the Makefile (it's in attach) to build JNI libraries under > OSX, (I started building SDL from sources, with binary frameworks it's > something similar) but when I try the video test I take > > > dottie:~/works/sdljava-0.9.1 gpciceri$ java -Djava.library.path=./lib > -cp ./classes/ sdljava.video.SDLVideoTest > Video subsystem initialized > 2005-03-20 18:20:50.004 java[21213] *** _NSAutoreleaseNoPool(): Object > 0x313f50 of class NSCFArray autoreleased with no pool in place - just > leaking > ... The problem is that MacOS (or rather Cocoa) seems to use pools for memory handling and that you have to initialize the pools in your application. I am not a MacOS developer, but I also tried getting SDLJava to run. In the SDLMain() method for SDL on MacOS this seems to be done, but since SDLJava doesn't use the main method it would have to be added to the wrapper code. And to my knowledge this pool would have to be created for _every_ thread which uses SDL. I made the necessary changes only to run into further problems. The test applications would start and then throw a SDL parachute exploded message after a few seconds so I guess that it needs more tweaking than that :) Anyway, if you want to play with this, here is what I changed: SDLMain_Wrap.c: JNIEXPORT jint JNICALL Java_sdljava_x_swig_SWIG_1SDLMainJNI_SDL_1Init(JNIEnv *jenv, jclass jcls, jlong jarg1) { jint jresult = 0 ; Uint32 arg1 ; int result; NSApplicationLoad(); // Init Cocoa (void)jenv; (void)jcls; arg1 = (Uint32)jarg1; result = (int)SDL_Init(arg1); jresult = (jint)result; return jresult; } SDLMain.java import com.apple.cocoa.foundation.*; public class SDLMain { private static int m_nMyPool; ... public static void init(long flags) throws SDLException { m_nMyPool = NSAutoreleasePool.push(); int result = SWIG_SDLMain.SDL_Init(flags); if (result == -1) { throw new SDLException(getError()); } start_time = System.currentTimeMillis(); } ... public static void quit() { SWIG_SDLMain.SDL_Quit(); NSAutoreleasePool.pop(m_nMyPool); } ... } Good luck :D Rainer -- "Happy ProMail" bis 24. März: http://www.gmx.net/de/go/promail Zum 6. Geburtstag gibt's GMX ProMail jetzt 66 Tage kostenlos! |