www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 4996] New: When D's dll unloaded, writeln(stdout) doesn't work well.

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4996

           Summary: When D's dll unloaded, writeln(stdout) doesn't work
                    well.
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: druntime
        AssignedTo: sean invisibleduck.org
        ReportedBy: zan77137 nifty.com


--- Comment #0 from SHOO <zan77137 nifty.com> 2010-10-05 09:31:02 PDT ---
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) --------------------------

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 05 2010
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4996


Rainer Schuetze <r.sagitario gmx.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |r.sagitario gmx.de


--- Comment #1 from Rainer Schuetze <r.sagitario gmx.de> 2010-10-05 11:57:22
PDT ---
This is a problem of the C runtime library. See bug 1550.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 05 2010
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4996


SHOO <zan77137 nifty.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |DUPLICATE


--- Comment #2 from SHOO <zan77137 nifty.com> 2010-10-06 05:50:52 PDT ---
(In reply to comment #1)

Oh, I see. Thanks!

*** This issue has been marked as a duplicate of issue 1550 ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 06 2010