win64 DLL stdout printing after main process completes

frame frame86 at live.com
Mon Apr 19 16:00:25 UTC 2021


On Monday, 19 April 2021 at 14:55:03 UTC, cc wrote:

> I would expect the first three lines of dll output to precede 
> the "[Main] x:" line at least.  Is there something I'm doing 
> wrong?  Do I need to somehow pass a reference to the main stdio 
> to the DLL's D runtime similar to how the GC can be shared?

Which compiler version are you using?
This is my output:

```
[dll] DLL_PROCESS_ATTACH
[dll] static this for mydll
[Main] Start
[dll] MyDLL_Test
[Main] x: 5
[Main] Finished
[Main] END
[dll] DLL_PROCESS_DETACH
[dll] static ~this for mydll
```

You miss a core.stdc.stdio import in main().
I also omit the def-File, maybe you have an error in it? It 
shouldn't be necessary to include. It just did:
```
dmd -m64 -ofmydll.dll -L/DLL mydll.d
```


More information about the Digitalmars-d-learn mailing list