------- Comment #7 from dannysmith at users dot sourceforge dot net 2006-09-13
10:10 -------
(In reply to comment #5)
> This is not DLL-related, the following code doesn't have the expected
> behaviour
> (although it works fine on i686-linux, even in the static case):
> $ cat ctesti.c
> #include <stdio.h>
> void print_from_gcc(char* txt) {
> printf("%s\n",txt);
> }
> int main(int argc, char** argv) {
> print_from_gcc ("c");
> print_from_gfortran_("f");
> print_from_gcc ("c");
> print_from_gfortran_("f");
> return 0;
> }
Changing main() in ctesti.c to start with:
int main(int argc, char** argv) {
setvbuf(stdout, NULL, _IOLBF, 0);
fixes the redirection problem.
If you stll think that this is a libgfortran bug (I don't)
you could add
setvbuf(stdout, NULL, _IOLBF, 0);
to unix.c:output_stream() so that stdout always is line-buffered even when
!isatty(fileno(stdout))
Danny
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27046