Mail Archives: djgpp/2001/05/09/14:03:07
> 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 -