www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/05/09/14:03:07

Date: Wed, 09 May 2001 19:49:51 +0300
From: "Eli Zaretskii" <eliz AT is DOT elta DOT co DOT il>
Sender: halo1 AT zahav DOT net DOT il
To: Michiel de Bondt <michielb AT sci DOT kun DOT nl>
Message-Id: <2561-Wed09May2001194951+0300-eliz@is.elta.co.il>
X-Mailer: Emacs 20.6 (via feedmail 8.3.emacs20_6 I) and Blat ver 1.8.9
CC: djgpp AT delorie DOT com
In-reply-to: <3AF96492.A518D019@sci.kun.nl> (message from Michiel de Bondt on
Wed, 09 May 2001 17:38:58 +0200)
Subject: Re: cprintf did not work
References: <3AF96492 DOT A518D019 AT sci DOT kun DOT nl>
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

> From: Michiel de Bondt <michielb AT sci DOT kun DOT nl>
> Newsgroups: comp.os.msdos.djgpp
> Date: Wed, 09 May 2001 17:38:58 +0200
> 
> I used cprintf in a constructor of a global object, but that did not
> work properly. But maybe, I am not allowed to use cprintf before
> calling main.

It's indeed not safe to call conio functions inside static
constructors, because conio needs to be initialized, and its
initialization is done by a static constructor.  Since you don't have
any control on the order in which static constructors are called (it's
entirely up to the linker), you could have problems.

If you can detect the situation when one of the conio functions is
called for the very first time since program start, you could work
around this problem by calling the `gppconio_init' function manually
(this is the function called by a static constructor).

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019