[Mono-devel-list] SDL on mac os x: has anyone managed it yet?

Jason Bell bell_jason at yahoo.ca
Thu Feb 24 04:06:40 EST 2005

Thanks for replying, Miguel:

I'll try to explain as best I can given my lack of
knowledge of objective c.  If you want to look at the
source yourself, download the SDL source from the
following.  I assume this mailing list doesn't support


and take a gander at SDLMain.h and SDLMain.m in:


First of all, the API used is Cocoa (I so wish they
had used Carbon instead, but oh well).  Let me know if
you're unfamiliar with mac os x and don't follow this,
though I'm somewhat new to os x myself.

In the main function SDL provides, a check is done to
see if a nib file is being used (a nib basically
provides the layout of a window, menus, buttons, and
such).  If a nib is being used it creates the
SDLApplication object and calls the function
NSApplicationMain, which creates the window and starts
the application loop.

If no nib is provided, a function called
CustomApplicationMain is called, that first creates an
autorelease pool.  This object essentially ensures
that objects are released properly and don't leak
memory.  In fact, currently, because none of this is
done, upon calling SDL_init you're spammed with a long
series of errors about memory being leaked due to lack
of an autorelease pool.

The SDLApplication object is created, then an
autorelease pool created.  Then an application
delegate is created (which I don't fully understand)
and assigned to the application object.  Then the
application starts via [NSApp run].

I have a feeling (JUST a feeling, mind), that if I
were to link libSDL.dylib against the mono runtime,
things may work, seeing as how it's the real
executable in this instance, it's written in c, and it
has a main function.  However, coming from windows, I
know nothing of make files.

If you have any suggestions, please let me know. 
Ditto with altering the make files so the mono runtime
links with libSDL.dylib.


 --- Miguel de Icaza <miguel at ximian.com> wrote: 
> > As some of you probably know, SDL (simple
> directmedia
> > layer) renames your c applications main function
> to
> > SDL_main using a macro, and provides it's own main
> > function, wherein it performs mac specific
> > initialisations.
> Can you be more specific about what kind of
> mac-specific things are done
> there?
> Miguel
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com

Post your free ad now! http://personals.yahoo.ca

More information about the Mono-devel-list mailing list