From: Christopher Bier Newsgroups: comp.os.msdos.djgpp Subject: Re: startup functions on gnu c/c++? Date: Tue, 14 Apr 1998 02:07:00 -0500 Organization: LCC Internet Lines: 32 Message-ID: <35330B14.F9D6578B@yahoo.com> References: <199804120455 DOT XAA18360 AT waller DOT net> <35305DE9 DOT 4EC1 AT acadia DOT net> NNTP-Posting-Host: conr-ddas1-a28.lcc.net Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk 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 void __crt0_setup_arguments (void); int main (void) { printf ("Hello\n"); } void __crt0_setup_arguments (void) { printf ("World!\n"); }