Re: [AD] Allegro main function in separate library

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


On 26 Jan 2010, at 0:37 , Chris Robinson wrote:
> I have to wonder why Allegro's still even using main mangling.

'cause Apple made some annoying design decisions that make it inevitable on OS X.
Seriously, when I talk about needing a magic main or writing portable code these days, it means writing code that compiles without modification on OS X as well as Windows/Linux.
So simple answer, we're using it because we can't do without something like it.

> The 5.0 API is a clean break from that, and represents a way to completely 
> avoid the design decisions that resulted in the need for the magic main stuff. 
> I'd much rather have an explicit END_OF_MAIN or even a clever al_main macro, 
> than hidden alterations to the standard main() routine that you need to opt 
> out of.

That's been discussed at length before.
Personally I much prefer END_OF_MAIN() myself, but there is a very simple reason to avoid doing that, which is that it's easy to forget on platforms that don't need it. Always having something like al_main(), apart from (in my opinion) being ugly as hell doesn't actually solve the problem, because you still need to have a main() somewhere that you're going to want to opt out of.
If you like, I can #define main al_main when a magic main is needed and #define al_main main when it's not, and you can always write either main() or al_main() and have it work. Personally I think that's a bit overkill.

> But personally, I think the design of the API should work so that 
> overriding the main entry point isn't needed in the first place.

Great idea. Unfortunately OS X doesn't work like that.

Evert



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