This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Unbuffered output in mixed C / Fortran programs


Georg Denk wrote:

> late. At least this was the result of a small test, where
> I added a putenv call at the beginning of the main
> routine (which is in C, but I don't think this makes
> a difference).

You might be able to arrange for the putenv to execute before the
libgfortran initialization routines by:

void whatever() __attribute__((constructor))
{
  putenv ("GFORTRAN_UNBUFFERED_PRECONNECTED=y");
}

If that still doesn't result in it being called early enough you can
also try giving it the lowest allowable numerical priority, e.g.
__attribute__((constructor(101))).  I seem to recall that 100 and below
are reserved for internal use, meaning it might be impossible to supply
a priority able to cause it to run earlier than internal library init
routines, but it's worth a try anyway.

Brian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]