lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Remo Dentato wrote:
> Compiling the standalone lua interpreter with mingw also shows an issue
> with printing to stderr. It seems that stderr is not flushed immediatly
> (as it happens with other Windows compilers, lcc for example).

IMHO this cannot be a problem of the compiler. It's more
a problem with the libraries or the execution environment.

> I personally added
>   #ifdef __MINGW32__
>     fflush(stderr);
>   #endif
> in lua.c at the end of both l_message() and print_usage().

Well, I have no problem getting the output from lua -h.
Did you run the compiled EXE under Wine or on 'real' Windows?

Because I've encountered a different variation: print()
doesn't work with my MingW compiled executable when I run
it under Wine in non-interactive mode.

I.e. lua -e 'print("foo")' gives no output. Typing the same
command at the Lua prompt works fine. OTOH io.write() works
in both modes.

If I replace the fputs() in lbaselib.c with fwrite() I can get
print() to work. Well ...

But when I run the same binary on Win98 everything works
as expected.

That's why I suspected a problem with my Wine installation.
I didn't bother to track it down until now. But since you
seem to have a similar problem ...

I've searched the MinGW and Wine archives to no avail. There
are some vague messages that hint at problems with flushing
stdout and stderr for ttys. But nothing conclusive.

In any case a change to Lua is not warranted until the real
cause for this is found.