Re: [AD] Proposal for new magic main |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
> So here's the proposition for 4.1.x:
> - no (more) magic main on systems that provide the standard main() entry
> point (all but Windows),
> - if ALLEGRO_NO_MAGIC_MAIN is not defined, 'int main(int argc, char
> *argv)' is a valid entry point on all systems and argv[0] contains the
> name of the executable (fullname or not); this effectively requires a
> magic main under Windows,
> - if ALLEGRO_NO_MAGIC_MAIN is not defined, END_OF_MAIN() is required on
> all platforms for the sake of portability,
> - get_executable_name(buf, size) is removed from the API and replaced by
> get_executable_fullname(buf, size, argv[0]),
> - USE_CONSOLE defines ALLEGRO_NO_MAGIC_MAIN.
Hmm... unfortunately it's not sufficient because:
- config.c (init_config): needs executable directory,
- file.c (pack_fopen_exe_file): needs executable name,
(find_allegro_resource): needs executable directory.
I must concede that I had a very Windows-centric viewpoint and miss the
following second point:
- under Windows, the magic main is needed to provide the user with a ISO C
main(),
- on POSIX systems, the magic main is needed to initialize the library,
- under DOS, the magic main is useless.
So we are back to the original problem: how to build a magic main which
works under Windows, various Unix flavors and Darwin ?
--
Eric Botcazou
ebotcazou@xxxxxxxxxx