This is the mail archive of the
cygwin@sourceware.cygnus.com
mailing list for the Cygwin project.
Re: BUG: stdin not a constant
- To: Fergus Henderson <fjh at cs dot mu dot OZ dot AU>
- Subject: Re: BUG: stdin not a constant
- From: Jim Sopchak <sopchak at aoainc dot com>
- Date: Thu, 04 Dec 1997 17:55:44 -0500
- CC: gnu-win32 at cygnus dot com, petdr at students dot cs dot mu dot oz dot au
- Organization: Adaptive Optics Associates
- References: <199712040048.LAA26596@rimmer.cs.mu.OZ.AU> <199712040820.TAA17063@mundook.cs.mu.OZ.AU>
- Reply-To: sopchak at aoainc dot com
Petdr,
Having dealt with the same problem in a port before, I've found the best
way to do it (IMHO), is to quickly identify all such globals (static or
otherwise) from the compiler/linker errors and initialize them first
thing in main() before any use. Think of it as being the same
responsibility you have when initializing member variables in a
constructor.
#include <stdio.h>
static FILE *out = (FILE *)NULL ;
void my_out_func(char *szMsg)
{
fprintf(out, "%s", szMsg);
}
void main(void)
{
out = stdout ;
fprintf(out, "hello world\n");
my_out_func("...so cold 'n cruel.\n") ;
}
Bon apetite,
Jim
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".