Re: [AD] Proposal for new magic main

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


On 2002-02-22, Eric Botcazou <ebotcazou@xxxxxxxxxx> wrote:
> If we effectively got rid of the magic main under Unix, I think we should
> keep the current Windows magic main (based on END_OF_MAIN) because it hasn't
> got the flaw Michael pointed out. Changing the magic main is really only
> needed for Unix, because of Darwin.

Actually, changing it is only necessary on Darwin because of the
linker ;-)  Does Darwin use glibc?  The following comes from the
glibc manual under Linux:


- Variable: char * program_invocation_name
     This variable's value is the name that was used to invoke the
     program running in the current process.  It is the same as
     `argv[0]'.  Note that this is not necessarily a useful file name;
     often it contains no directory names.  *Note Program Arguments::.

 - Variable: char * program_invocation_short_name
     This variable's value is the name that was used to invoke the
     program running in the current process, with directory names
     removed.  (That is to say, it is the same as
     `program_invocation_name' minus everything up to the last slash,
     if any.)

   The library initialization code sets up both of these variables
before calling `main'.

   *Portability Note:* These two variables are GNU extensions.  If you
want your program to work with non-GNU libraries, you must save the
value of `argv[0]' in `main', and then strip off the directory names
yourself.  We added these extensions to make it possible to write
self-contained error-reporting subroutines that require no explicit
cooperation from `main'.


Unless other libc's are used under Darwin, we can ignore that
portability note.



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