Bug 4996 – When D's dll unloaded, writeln(stdout) doesn't work well.

Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
druntime
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2010-10-05T09:31:00Z
Last change time
2010-10-06T05:50:52Z
Assigned to
sean
Creator
zan77137

Comments

Comment #0 by zan77137 — 2010-10-05T09:31:02Z
When D's dll unloaded, writeln(stdout) doesn't work well. I guess that druntime's dll termination was failure. Or, my miss. Do you understand this cause? ---------------- dll.d ------------------------- import std.c.windows.windows; import core.dll_helper; __gshared HINSTANCE g_hInst; extern (Windows) BOOL DllMain(HINSTANCE hInstance, ULONG ulReason, LPVOID pvReserved) { switch (ulReason) { case DLL_PROCESS_ATTACH: g_hInst = hInstance; dll_process_attach( hInstance, true ); break; case DLL_PROCESS_DETACH: dll_process_detach( hInstance, true ); break; case DLL_THREAD_ATTACH: dll_thread_attach( true, true ); break; case DLL_THREAD_DETACH: dll_thread_detach( true, true ); break; } return true; } ----------------- main.d ----------------------- import std.stdio; import core.runtime; void main() { writeln("???????????????????"); auto h = Runtime.loadLibrary("dll.DLL"); Runtime.unloadLibrary(h); writeln("!!!!!!!!!!!!!!!!!!!"); } ---------------- module.def ------------------- LIBRARY DLL DESCRIPTION 'DLL Module' EXETYPE NT CODE PRELOAD DISCARDABLE DATA WRITE EXPORTS ----------------- RESULT ----------------------- $ dmd module.def dll.d $ dmd -run main.d ??????????????????? ----------------- (END) --------------------------
Comment #1 by r.sagitario — 2010-10-05T11:57:22Z
This is a problem of the C runtime library. See bug 1550.
Comment #2 by zan77137 — 2010-10-06T05:50:52Z
(In reply to comment #1) Oh, I see. Thanks! *** This issue has been marked as a duplicate of issue 1550 ***