Re: [AD] Proposal for new magic main |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
"Eric Botcazou" <ebotcazou@xxxxxxxxxx> writes:
> [...skipped...]
> with of course a little tweak (WinMain instead of main) under Windows.
> The big advantage is that END_OF_MAIN() is no longer needed, the drawback is
> that it is replaced by the mandatory ISO C-compliant declaration of main(),
> i.e 'int main(int argc, char *argv[])'.
> [...skipped...]
And one more problem is that main can not be used in structs.
END_OF_MAIN() is good (portable and allows to use main as entry
point), but requires to have real main in some other file.
If program entry point supplied by user was not called 'main'
(e.g. al_main), then END_OF_MAIN macro (or IMPLEMENT_MAIN macro, which
can be placed anywhere, not only after user supplied main) may have
instance of main (or WinMain), which calls al_main.
But it would be nice to allow initialization of most parts of Allegro
without these 'main' tricks, by passing (argc, argv) to allegro_init
(or al_init_system (argc, argv, ...)), or something like that. Then
IMPLEMENT_MAIN macro and al_main will be used only to provide
portability between platforms, but will allow the use of other
portable entry point implementations (for example, IMPLEMENT_APP in
wxWindows).
--
Michael Bukin