Mail Archives: djgpp/2002/02/15/07:00:18
Eli Zaretskii wrote:
>
> > From: CBFalconer <cbfalconer AT yahoo DOT com>
> > Newsgroups: comp.os.msdos.djgpp
> > Date: Fri, 15 Feb 2002 08:40:10 GMT
> >
> > I suspect the first malloc call is made before the global arena is
> > setup.
>
> No, that's not true, but it did give me a clue of what's happening:
> the conio functions need initialization. That initialization runs
> from a static constructor, which is called just before `main'. But
> malloc is called before that, from the startup code, so you end up
> invoking cprintf without it being properly initialized.
But that doesn't explain why the static 'firstime' control failed?
That should have prevented the initial cprintf calls, and in my
experiment there were no others.
>
> My bad, I should have thought about this before.
>
> So DJ's advice, to use sprintf and then write the buffer with a call
> to the function `write', is better.
>
> > This is annoying. If other things aren't set up, I am very leery
> > of calling anything whatsoever at this point. Who knows what is
> > getting written on.
>
> Don't give up ;-)
The file system to receive 'write' has no more reason to be
initialized at that point than does cprintf, does it?
--
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)
- Raw text -