This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: __main?
- To: Axel Kittenberger <Anshil at gmx dot net>
- Subject: Re: __main?
- From: Alexandre Oliva <aoliva at redhat dot com>
- Date: 26 Jan 2001 08:02:35 -0200
- Cc: gcc-help at gcc dot gnu dot org
- Organization: GCC Team, Red Hat
- References: <10423.980501084@www33.gmx.net>
On Jan 26, 2001, Axel Kittenberger <Anshil@gmx.net> wrote:
> Unfortunally one of my routines is called "main", and somehow gcc seems to
> handle that one specially :), however in my case this just a function like
> every one else.
How is GCC supposed to figure it out? main() *is* a special function
in C. You aren't even allowed to take its address or to call it.
Don't name a regular function main().
> To be exact, after compiling that file containing the main function
> it stops at linking stage with an unresolved link to "__main".
> [...] Did gcc create that? or what is it?
Yep. On certain platforms, GCC arranges for main() to call __main(),
that runs static initializers.
--
Alexandre Oliva Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist *Please* write to mailing lists, not to me