X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-bounces using -f Message-ID: <3C6D62E3.34091E03@yahoo.com> From: CBFalconer Organization: Ched Research X-Mailer: Mozilla 4.75 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.os.msdos.djgpp Subject: Re: Malloc/free DJGPP code References: <3C6C735D DOT A6D16719 AT yahoo DOT com> <1225-Fri15Feb2002084500+0200-eliz AT is DOT elta DOT co DOT il> <3C6CC93C DOT 6F9E05E6 AT yahoo DOT com> <2947-Fri15Feb2002112947+0200-eliz AT is DOT elta DOT co DOT il> <3C6CF755 DOT CC35209E AT yahoo DOT com> <7680-Fri15Feb2002142924+0200-eliz AT is DOT elta DOT co DOT il> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 35 Date: Fri, 15 Feb 2002 19:36:02 GMT NNTP-Posting-Host: 12.90.173.123 X-Complaints-To: abuse AT worldnet DOT att DOT net X-Trace: bgtnsc05-news.ops.worldnet.att.net 1013801762 12.90.173.123 (Fri, 15 Feb 2002 19:36:02 GMT) NNTP-Posting-Date: Fri, 15 Feb 2002 19:36:02 GMT To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Eli Zaretskii wrote: > > > From: CBFalconer > > Newsgroups: comp.os.msdos.djgpp > > Date: Fri, 15 Feb 2002 11:58:27 GMT > > > > But that doesn't explain why the static 'firstime' control failed? > > I think it failed because malloc is called from the startup code more > than once. So the condition guarded the very first call, but not the > others. > > > The file system to receive 'write' has no more reason to be > > initialized at that point than does cprintf, does it? > > The call to `write' doesn't need any initializations, assuming you > write to handles 1 or 2, which are already preconnected when the > program starts. `write' is more or less straightforward path to a DOS > call (you can use `_write' if you want to be even closer to the DOS > call, but in that case, you will need to use "\r\n" to end a line). Finally I have debug output. The combination of sprintf to a local buffer and write actually works. You were right, there are a lot more calls to sbrk during initialization (around 40), but I guess the clobbered output mechanisms could never show them, so I thought there was just the one. This way output *CAN* be redirected. -- Chuck F (cbfalconer AT yahoo DOT com) (cbfalconer AT XXXXworldnet DOT att DOT net) Available for consulting/temporary embedded and systems. (Remove "XXXX" from reply address. yahoo works unmodified) mailto:uce AT ftc DOT gov (for spambots to harvest)