Re: [AD] Proposal for new magic main

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


> Not in general -- asking about any Unix is a bit like asking
> about any compiler under the sun. :)  Linux has some ways (I
> think Allegro uses them) but it's not reliable.

Ok, let's forget that.

> Hmm.  If only it was: get_executable_name (argv[0], buf, size).
> :)  In the end, on generic Unix at least, it ends up having to
> search the $PATH for the binary, and might not even find it.

It seems to me that's the most sensible solution, at the expense of a
(minor) API breakage though.

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.

--
Eric Botcazou
ebotcazou@xxxxxxxxxx



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