Re: rt_init, rt_term and _initCount

2016-10-22 Thread Benjamin Thaut via Digitalmars-d
On Saturday, 22 October 2016 at 07:12:48 UTC, Rainer Schuetze wrote: Please also consider that the main executable might not know about DLLs being written in D. In that case all termination must be triggered by the druntime DLL. The case where the main executable is not D is working fine.

Re: rt_init, rt_term and _initCount

2016-10-22 Thread Rainer Schuetze via Digitalmars-d
On 22.10.2016 01:21, Benjamin Thaut wrote: On Friday, 21 October 2016 at 19:40:52 UTC, Rainer Schuetze wrote: The wrapper around main in the executable should work just as any DLLs' DllMain, i.e. it should register/unregister its own data segments with the GC and run its shared and TLS

Re: rt_init, rt_term and _initCount

2016-10-21 Thread Benjamin Thaut via Digitalmars-d
On Friday, 21 October 2016 at 19:40:52 UTC, Rainer Schuetze wrote: The wrapper around main in the executable should work just as any DLLs' DllMain, i.e. it should register/unregister its own data segments with the GC and run its shared and TLS module constructors/decoontructors. Everything

Re: rt_init, rt_term and _initCount

2016-10-21 Thread Rainer Schuetze via Digitalmars-d
On 20.10.2016 09:17, Benjamin Thaut wrote: This is a topic really specific to druntime, I don't know a better place to put it though. rt_init increases the _initCount and rt_term decreases it and only terminates the runtime in case the _initCount reaches zero (see dmain2.d) [...] The

Re: rt_init, rt_term and _initCount

2016-10-20 Thread Benjamin Thaut via Digitalmars-d
On Thursday, 20 October 2016 at 08:44:09 UTC, Ethan Watson wrote: On Thursday, 20 October 2016 at 07:17:49 UTC, Benjamin Thaut wrote: Any suggestions how to solve this problem? Who are other platforms doing it? Would this also be a bigger problem if people use LoadLibrary and don't

Re: rt_init, rt_term and _initCount

2016-10-20 Thread Patrick Schluter via Digitalmars-d
On Thursday, 20 October 2016 at 07:17:49 UTC, Benjamin Thaut wrote: This is a topic really specific to druntime, I don't know a better place to put it though. rt_init increases the _initCount and rt_term decreases it and only terminates the runtime in case the _initCount reaches zero (see

Re: rt_init, rt_term and _initCount

2016-10-20 Thread Ethan Watson via Digitalmars-d
On Thursday, 20 October 2016 at 07:17:49 UTC, Benjamin Thaut wrote: Any suggestions how to solve this problem? Who are other platforms doing it? Would this also be a bigger problem if people use LoadLibrary and don't FreeLibrary after?

rt_init, rt_term and _initCount

2016-10-20 Thread Benjamin Thaut via Digitalmars-d
This is a topic really specific to druntime, I don't know a better place to put it though. rt_init increases the _initCount and rt_term decreases it and only terminates the runtime in case the _initCount reaches zero (see dmain2.d) The problem now is as follows. Each dynamic library that is