Re: [AD] Magic main in Windows

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


Evert Glebbeek wrote:
Personally, I don't like requireing the user to write an al_main() rather than a main() function.

They wouldn't be required to use al_main. As I said in the reply, to disable this behavior, all you have to do is not create an al_main function. That way, al_main will never be replaced with the define that creates main/WinMain (because it doesn't exist).

Basically, the user would code this:

int al_main(...)
{
}

The C-preprocessor will get the 'al_main' define and turn it into this:

int al_main(...);

int main()
{
   allegro_init();
   return al_main();
}

int al_main(...)
{
}

Now, if the user doesn't want auto-main-handling, he'd simply not create al_main and the define will never be expanded to make the main/WinMain function.

- Kitty Cat




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