Bug 16475 – Unloading Shared Library Closes stdout File Handle.

Status
NEW
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Windows
Creation time
2016-09-07T19:31:16Z
Last change time
2024-12-13T18:49:58Z
Assigned to
No Owner
Creator
Jack
Moved to GitHub: dmd#19186 →

Attachments

IDFilenameSummaryContent-TypeSize
1613asm.txtassemblytext/plain5660

Comments

Comment #0 by gyroheli — 2016-09-07T19:31:16Z
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
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/19186 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB