Created attachment 1613
assembly
If you load and unload a shared library with DMD on windows using Runtime.loadLibrary and unloadLibrary. This causes the stdout file handles to be closed. It seems the issue is with the function that calls DllMain, when it detaches from process it calls the C function "exit()" which in turn closes the file handles.
import core.runtime;
import std.stdio;
void* library = Runtime.loadLibrary("myDlib.dll");
Runtime.unloadLibrary(library);
writeln("hello");
stdout.flush(); // fails errno 9, bad file number
Comment #1 by robert.schadek — 2024-12-13T18:49:58Z