Pb mixing C & Fortran IO
Sat May 8 23:28:00 GMT 1999
> > I encounter a problem when mixing C and Fortran IO in my code. Here are samples that
> > reproduce the problem :
> Don't do that. Any file or unit opened in one module cannot be safely
> accessed in another module (via the usual language facilities, anyway,
> which includes g77's libU77 routines, such as FGETC) *unless* that module
> is uses the same level of language facilities (where Fortran's WRITE and
> g77's FPUTC are on *two* different levels) *and* is compiled by the same
Do you mean C's FPUTC ?
I do understand but this is working on most of the systems I am using and Linux (+egcs)
(which is quite important for me) is the only one which crashes.
I was thinking that by the end the fortran library was in C so I was expecting the mix to
work at least for stdout...;-(
> And, yes, we need to document this. We explain it this way in the docs
> on each of the pertinent libU77 intrinsics:
> Stream I/O should not be mixed with normal record-oriented (formatted or
> unformatted) I/O on the same unit; the results are unpredictable.
> However, we should explain it also in writeups on inter-language and
> inter-compiler mixing. I'll work on this later.
> One approach I think some people use to avoid this whole problem is to
> code all I/O in C, and all number-crunching in Fortran, when they have
> to use both.
This is indeed a good idea but my code is running out-of-core and I would do the same
if I could get in C the same performance as for the fortran direct unformatted I/O... but
anyway if there is no other alternative.
> tq vm, (burley)
Thanks for your help
More information about the Gcc-bugs