Re: [hatari-devel] OS X SDL2 fixes

[ Thread Index | Date Index | More lists.tuxfamily.org/hatari-devel Archives ]


Eero,

Also I’m not a programmer! I dowloaded SDL2 sources and I compared with SDL1 sources.
Compiled with SDL2, Hatari crashs immediately at launch. None in my breakpoints are encountered.
See this piece of code from  SDL_main.h in SDL2:

#elif defined(__IPHONEOS__)
/* On iOS SDL provides a main function that creates an application delegate
   and starts the iOS application run loop.
   See src/video/uikit/SDL_uikitappdelegate.m for more details.
 */
#define SDL_MAIN_NEEDED

#elif defined(__ANDROID__)
/* On Android SDL provides a Java class in SDLActivity.java that is the
   main activity entry point.

   See README-android.txt for more details on extending that class.
 */
#define SDL_MAIN_NEEDED

#endif
#endif /* SDL_MAIN_HANDLED */

#ifdef __cplusplus
#define C_LINKAGE   "C"
#else
#define C_LINKAGE
#endif /* __cplusplus */

/**
 *  \file SDL_main.h
 *
 *  The application's main() function must be called with C linkage,
 *  and should be declared like this:
 *  \code
 *  #ifdef __cplusplus
 *  extern "C"
 *  #endif
 *  int main(int argc, char *argv[])
 *  {
 *  }
 *  \endcode
 */

#if defined(SDL_MAIN_NEEDED) || defined(SDL_MAIN_AVAILABLE)
#define main    SDL_main
#endif

As you can see macro SDL_MAIN_NEEDED is defined for IOS and not defined for OSx.
In SDL_main.h of  SDL1 this macro is defined for IOS and OSx
This implies that  compiled with SDL1  main  function is called,  but compiled with SDL2  main function is not called.
I change line #elif defined(__IPHONEOS__)  by line  #elif defined(__IPHONEOS__) || defined(__MACOSX__)
I compile SDL2 then compile Hatari. Now Hatari launchs then breakpoint in applicationDidFinishLaunching: function stop the launch process.

Following the launch process, I find that  Hatari crashs during initialization of SDL. But I don’t know enough Hatari and SDL to continue!

Miguel


Eero,

I am not a programmer anymore, but your explanation makes sense to me. I am assuming it is simply a difference between SDL1 and SDL2.


Bob C


M et Y Saro
Méaudre:  09 53 21 77 32
Seyssinet: 09 52 91 16 20
Fax: 09 57 91 16 20
http://locations.vercors.free.fr/



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/