Re: [AD] END_OF_MAIN removal patch for msvc

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


Peter Hull wrote:
On Mon, Nov 17, 2008 at 11:40 AM, Evert Glebbeek <eglebbk@xxxxxxxxxx> wrote:
On 17 Nov 2008, at 03:24, Peter Hull wrote:
Aha! So we could get rid of it on Leopard but not on Tiger? That's a
bit useless if you're trying to compile a program that works on both
(and we should not drop support for Tiger)... was it tested? I could
(when I find the time) test it on my MacBook.
The ucontext stuff was added for Leopard AFAICS. So we'd just have to
implement a subset of that functionality for ourselves. I think it's
covered under the open source darwin bit so we could look to see how
it is actually implemented in Leopard (might clang the licence if we
copied it directly though), or there is this
http://swtch.com/libtask/
which is under the MIT license, and  has been used in various
libraries here and there.

However this whole approach is a bit hackish (e.g. debugging would be
confusing, I guess).

I guess we could do what END_OF_MAIN does with a macro like the below, if that's better.


#define main _mangled_main(int, char**);  \
    int main(int argc, char** argv)       \
    {                                     \
        do_allegro_stuff(argc, argv);     \
        return _mangled_main(argc, argv); \
    }                                     \
    int _mangled_main


Because of the strict prototyping in C++, we'd have to require the user to always define main to take two args. Not so for C. At least END_OF_MAIN would be gone.





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