Mixed language i/o sychronization

Erik Schnetter schnetter@aei.mpg.de
Tue Aug 9 08:16:00 GMT 2005


On Tuesday 09 August 2005 09:42, FX Coudert wrote:
> > The g77 I/O library is implemented using the buffered ISO C
> > routines (e.g. fwrite() and friends), while gfortran has its own
> > buffer implementation. That is why g77 plays well when combined
> > with C programs, and gfortran less so.
>
> Yes. While technically this isn't a gfortran bug (flushing streams
> after using them is the responsibility of each language, and gfortran
> does this part well), most of the people with mixed language code
> have code that relied on this particular behavior of g77. I'm trying
> to work on an option that could help with this, by preemptively
> flushing some streams before it gets to the real I/O. However, this
> cannot and will not work in the general case.

I think that the only way in which one can make this work reliably and 
efficiently is to use the same buffering mechanism for both C and 
Fortran.  That is, one needed to use fwrite() and friends.

Language interoperability is important to me.  Would it be difficult to 
switch from the current I/O mechanism to fwrite, e.g. depending on a 
compiler option?  I'm not asking for anybody to do that, just testing 
the feasibility and acceptance of such an approach.

-erik

-- 
Erik Schnetter <schnetter@aei.mpg.de>   http://www.aei.mpg.de/~eschnett/

My email is as private as my paper mail.  I therefore support encrypting
and signing email messages.  Get my PGP key from www.keyserver.net.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20050809/f6f0a798/attachment.sig>


More information about the Fortran mailing list