win64 DLL stdout printing after main process completes

Mike Parker aldacron at gmail.com
Mon Apr 19 16:04:28 UTC 2021


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

>
> And upon running, the output I receive is:
> ```
> [Main] Start
> [Main] x: 5
> [Main] Finished
> [Main] END
> [dll] DLL_PROCESS_ATTACH
> [dll] static this for mydll
> [dll] MyDLL_Test
> [dll] DLL_PROCESS_DETACH
> [dll] static ~this for mydll
> ```
>
> 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?

It's probably just due to buffering. Insert a fflush(stdout) 
after the calls to printf in your DLL and see what happens.


More information about the Digitalmars-d-learn mailing list