What was the fix? The example in samples/d/mydll compiles fine and looks very much the same.

Note that I'm talking about D2.

1. The path in build.bat is incorrect: is ..\..\..\bin\dmd instead of ..\..\..\windows\bin\dmd
2. printf isn't defined by default anymore.
3. The gc code etc in DllMain is for D1 I guess. I used code from http://www.digitalmars.com/d/2.0/dll.html instead.
4. HINSTANCE g_hInst; wasn't (__g)shared


In contrast to printf the std.stdio.write functions seem to buffer the output. When the DLL is unloaded, console output is already closed by the application.

Two possible solutions:
1. call stdout.flush() after writing

doesn't fix it.


2. set std.c.stdio._fcloseallp = null; before terminating the exe, but expect scrumbled output from the DLL and the exe

fixes it. need to find out why.

Reply via email to