Re: [AD] Allegro main function in separate library

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


On 26 Jan 2010, at 12:29 , Elias Pschernig wrote:
> The reasons in A5 are very different. Basically, OSX is today's DOS. And
> so in order to *not* be forced into the OSX-centric few of things we
> have to hijack main() which allows A5 events to work the same way on all
> paltforms.

In a way it's the opposite to the DOS-based design of A4: there magic main made sure all other platforms behaved, on some level, as DOS. In A5 it is the other way around: OS X is "the odd one out" and magic main only affects OS X (with the caveat that there may be circumstances where a magic main might be needed on UNIX to get the executable name, but who wants that really?).

I've always thought of the motivation behind A4's magic main as coming from two necessities: the non-standard WinMain() in Windows, which would make it impossible to write portable code that compiles in Windows as well as DOS/UNIX, and the need to grab the path to the executable in UNIX, where argv[0] may be the only reliable way to find out the name of the executable and hence work out the path.
The first of these, it now turns out, can be worked around. This may always have been possible but just not very obvious. The second is of dubious use in the UNIX world and is clearly a remnant from the DOS-centric original design and way of thinking. This is completely gone in A5, which has a proper path API.
The fact that magic main is needed on OS X was, I think, not immediately obvious. I don't quite remember when A4's OS X port was announced, but I seem to recall that at the time it was not obvious how to get around the requirement of running the message queue in the main thread.

Anyway. Magic main is gone for all systems except for OS X, where it can be easily disabled (which was not the case in A4). I'd say all's well. :)

Evert





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