[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ^Z signal



This again...

> ; make 'CC=gcc ile'
> gcc ile -g   -c ile.c -o ile.o
> gcc: ile: linker input file unused since linking not done
> cc -o ile ile.o -ltermcap
> ld: Undefined symbol 
>    ___main 
> Compilation failed

To handle global C++ constructors, and because it can't modify crt0 on
any given machine, GCC automatically inserts a call to __main() inside
a program's main().  If you use `gcc' to link the program, it will also
automatically include libgcc.a, which has a default __main().

__main() calls each constructor in turn and uses atexit() to register a
procedure will calls all the global destructors.