Date: Wed, 30 Jul 1997 11:51:14 -0700 (PDT) Message-Id: <199707301851.LAA11762@adit.ap.net> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" To: darn AT xl DOT ca From: Nate Eldredge Subject: Re: custom entry/exit code Cc: djgpp AT delorie DOT com Precedence: bulk You wrote: >How do I link my own extra entry/exit code into a c project? Okay, here are three ways, in increasing order of difficulty. - Run your entry code at the beginning of `main', and use `atexit' to set up exit code. (Trivial, but often sufficient.) - Use the GNU extensions "constructor" and "destructor". That would look something like this: void hello(void) __attribute__ ((constructor)); void bye(void) __attribute__ ((destructor)); void hello(void) { /* ... do stuff ... */ } void bye(void) { /* ... do more stuff ... */ } - Rewrite crt0.o. Nate Eldredge eldredge AT ap DOT net