Re: [AD] No need for END_OF_MAIN (Windows)

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


Evert Glebbeek wrote:
I would be very surprised if that doesn't give problems somewhere some how. Does it really work well if you compile and link a multi-file project? Does this mean a WinMain is added to each Allegro sourcefile that ends up in the library or DLL?

What about, at least for 4.3+, you have the user place a define in the source file that contains main. So, it'd be like:

#define ALLEGRO_MAIN
#include <allegro.h>

...

int main()
{
   return 0;
}

That way, Allegro would only define it once and the user wouldn't have to put END_OF_MAIN() or ALLEGRO_NO_MAGIC_MAIN. If they wanted to make their own WinMain or whatever, they just don't define it.

I'd just be sure to make a huge warning about OSX users.. that the real main function should be something else (say, user_main), and the user-created main should call soemthing like: al_osx_startup(user_main); when they want to start using allegro stuff, which would throw the current thread into device polling and run user_main in a seperate one. Evil, yeah, but that's only applicable when the user wants to handle main themselves. It's more evil for OSX to require input gathering to be done on the main thread.

Of course, we could always push the use of the polling functions in such a case...?




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