Re: [AD] got rid of END_OF_MAIN() |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
On Monday 09 August 2004 14:13, Michael Benfield wrote:
> This actually seems to work under gcc at least. Although I think you
> have to cast the fp to the correct type:
> void (*main2)(int, char **) = (void (*) (int, char**) &_mangled_main;
From src/umain.c:
int main(int argc, char *argv[])
{
int (*real_main) (int, char*[]) = (int (*) (int, char*[]))
_mangled_main_address;
__crt0_argc = argc;
__crt0_argv = argv;
return (*real_main)(argc, argv);
}
Using the function pointer allows the real main() routine to be either
main(void) or main(int, char**). Always using a function pointer would
eliminate the need to have the user declare his main as main(int,
char**).
But that may be what you were saying anyway.
Evert