On Monday, 19 April 2021 at 18:32:15 UTC, Adam D. Ruppe wrote:
On Monday, 19 April 2021 at 18:05:46 UTC, cc wrote:
This seems to work if I flush after every printf or write in
both main and the dll. I was under the impression they were
supposed to share the same IO buffers though, is this not the
case?
Very little in D dlls right now are shared, so there's
duplicate buffers and functions in the dll do not necessarily
affect the exe's copies. It basically works in most cases but
this can cause some quirks and bugs in some situations.
That makes sense, thanks.
Adding a note in case anyone stumbles across this with a similar
problem:
Adding `stdout.setvbuf(0, _IONBF);` to both the main and DLL will
cause D to autoflush after every write call without requiring a
manual flush (which seems to happen quite often when running
under anything other than a basic Windows command prompt).