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

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


> Unfortunately, this will break code that has a struct member named main.
> That may sound like an academic case, but it probably isn't.
> It also suffers from the problem that int _mangled_main(); doesn't mean the
> same thing in C++ as it does in C, although you can probably get around
> that by replacing () with (int argc, char **argv).
> How do others feel about this for the 4.3 branch?

So close and yet so far. To bad there is no macro overloading, so we
could have one for main() and other for main(int, char **)

> What version of Allegro did you use to make your patch? END_OF_MAIN() is
> already optional in DOS and *NIX (although the *NIX port can be configured
> to make it nescessary), but needed in Windows and MacOS X. Getting rid of
> it on as many platforms as possible is nice, but unless we can do the same
> for MacOS X (which, if I recall correctly, we can't) there's not much point
> in trying too hard.

I search trough almac.h and alosx.h and only found this:

> #ifndef ALLEGRO_NO_MAGIC_MAIN
>    #define ALLEGRO_MAGIC_MAIN
>    #define main _mangled_main
>    #undef END_OF_MAIN
>    #define END_OF_MAIN() void *_mangled_main_address = (void*) _mangled_main;
> #else
>    #undef END_OF_MAIN
>    #define END_OF_MAIN() void *_mangled_main_address;
> #endif

And as I said before didn't find where is _mangled_main_address used.




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