Re: [AD] Magic main in Windows

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


Elias Pschernig wrote:
Or require an al_process_events function, which must be called from the
main thread:

You mean, like the polling functions we have now? ;) Though I know how much everyone /looves/ polling. Perhaps allegro_init() could spawn off into a new thread, continuing the user code where it left off, and in the main thread, do whatever it does now? The only problem I see is that the new thread won't know where to return to from allegro_init.

Btw, does that function ordering change in gcc someone recently
mentioned also affect END_OF_MAIN()?

AFAIK, END_OF_MAIN takes care of the different main declaration possibilities.

Maybe we can remove END_OF_MAIN() by some other #define magic.. defining
"main" to something else in allegro.h, then calling that (from another
thread e.g. in the case of OSX).

I still think using al_main would be best. al_main is an actual, user-created function. Then, Allegro supplies its own main function that calls al_main. So, you'd have this:

#define al_main \
al_main(whatever we decide is best here); \
int main() /* or WinMain */ \
{ \
   allegro_init();
   return al_main(); \
} \
int al_main

The use would just have:

int al_main(...)
{
   // program as normal
}

which would turn into:

int al_main(whatever we decide is best here);
int main() /* or WinMain */
{
   allegro_init();
   return al_main();
}
int al_main(...)
{
   // program as normal
}

Though as I said last time, I don't know how well this would integrate with Allegro's current END_OF_MAIN hacks.




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