Mail Archives: djgpp/1998/04/14/03:18:47
Scott Warner wrote:
>
> Conrad Wei-Li Song wrote:
> >
> > Quicky question:
> >
> > How to I define functions to be called on program startup before main is
> > called?
> > Thanks.
>
> I don't think you can. main() is always the first function called. Why
> would you want to do such a thing?
Tickles my curiosity too! But, whatever your reasons, section 18.5 of
the FAQ may help. While you might not be able to define new start-up
functions, you can define your own versions of preexisting ones.
#include <stdio.h>
void __crt0_setup_arguments (void);
int
main (void)
{
printf ("Hello\n");
}
void
__crt0_setup_arguments (void)
{
printf ("World!\n");
}
- Raw text -