Re: static ctors in shared libs

2016-03-27 Thread Guillaume Piolat via Digitalmars-d
On Sunday, 27 March 2016 at 22:08:57 UTC, bitwise wrote: If TLS static ctors simply weren't run at all for dynamically loaded libraries, there would be no confusion. Any D user that tried to explore the use of shared libraries, would quickly learn that TLS ctors are not called at all for

Re: static ctors in shared libs

2016-03-27 Thread bitwise via Digitalmars-d
On Sunday, 27 March 2016 at 19:31:46 UTC, Guillaume Piolat wrote: On Sunday, 27 March 2016 at 17:58:01 UTC, bitwise wrote: On Sunday, 27 March 2016 at 16:54:53 UTC, bitwise wrote: Phobos should be linked statically even when it's a shared library, so it should still have all static ctors

Re: static ctors in shared libs

2016-03-27 Thread Guillaume Piolat via Digitalmars-d
On Sunday, 27 March 2016 at 17:58:01 UTC, bitwise wrote: On Sunday, 27 March 2016 at 16:54:53 UTC, bitwise wrote: Phobos should be linked statically even when it's a shared library, so it should still have all static ctors called properly. Bit Correction...Phobos would be statically

Re: static ctors in shared libs

2016-03-27 Thread bitwise via Digitalmars-d
On Sunday, 27 March 2016 at 16:54:53 UTC, bitwise wrote: Phobos should be linked statically even when it's a shared library, so it should still have all static ctors called properly. Bit Correction...Phobos would be statically linked to a dynamically loaded shared library. This could

Re: static ctors in shared libs

2016-03-27 Thread bitwise via Digitalmars-d
On Sunday, 27 March 2016 at 11:38:15 UTC, Guillaume Piolat wrote: On Sunday, 27 March 2016 at 03:28:31 UTC, bitwise wrote: I was hoping to have some more people weigh in with their experience with plugins, whether or not they're expected to be multi-threaded, thread-safe, etc.. I think the

Re: static ctors in shared libs

2016-03-27 Thread Guillaume Piolat via Digitalmars-d
On Sunday, 27 March 2016 at 03:28:31 UTC, bitwise wrote: I was hoping to have some more people weigh in with their experience with plugins, whether or not they're expected to be multi-threaded, thread-safe, etc.. I think the current design is fragile, and given the limited usage of D shared

Re: static ctors in shared libs

2016-03-26 Thread bitwise via Digitalmars-d
On Saturday, 26 March 2016 at 03:08:13 UTC, Joakim wrote: On Friday, 25 March 2016 at 16:33:26 UTC, bitwise wrote: On Thursday, 24 March 2016 at 00:56:33 UTC, bitwise wrote: Thoughts? Bit Ok..How about "Thought"? One thought will do. I'll take what I can get ;) Bit Martin is

Re: static ctors in shared libs

2016-03-25 Thread Joakim via Digitalmars-d
On Friday, 25 March 2016 at 16:33:26 UTC, bitwise wrote: On Thursday, 24 March 2016 at 00:56:33 UTC, bitwise wrote: Thoughts? Bit Ok..How about "Thought"? One thought will do. I'll take what I can get ;) Bit Martin is the guy to talk to, he wrote all that code. David might

Re: static ctors in shared libs

2016-03-25 Thread bitwise via Digitalmars-d
On Thursday, 24 March 2016 at 00:56:33 UTC, bitwise wrote: Thoughts? Bit Ok..How about "Thought"? One thought will do. I'll take what I can get ;) Bit

Re: static ctors in shared libs

2016-03-23 Thread bitwise via Digitalmars-d
. As far as dynamic linking goes, I don't like how the current solution works. It can lead to very confusing problems, and I think it would be better to do an all-or-nothing approach: -statically linked shared libs always have shared static ctors called -statically linked shared libs always have TLS

Re: static ctors in shared libs

2016-03-23 Thread bitwise via Digitalmars-d
On Friday, 18 March 2016 at 16:23:00 UTC, Johannes Pfau wrote: Am Fri, 18 Mar 2016 14:35:41 + schrieb Marc Schütz : [...] Thanks for the explanation! When I first looked at the elf implementation, I was confused by what was goign on with

Re: static ctors in shared libs

2016-03-20 Thread Marc Schütz via Digitalmars-d
On Thursday, 17 March 2016 at 20:54:57 UTC, Johannes Pfau wrote: It's been some time since I looked at that code, but IIRC TLS ctors for newly loaded libraries are not run in old threads. There's nothing we can do about this without help from the C runtime. Hmm... are all module

static ctors in shared libs

2016-03-19 Thread bitwise via Digitalmars-d
I've been doing some work on shared libraries for OSX, and have come across a potential problem, which I'm not sure what to do with. Currently, when a thread is spawned, that thread calls all the TLS ctors, then runs the thread entry point function, and finally calls the TLS dtors before the

Re: static ctors in shared libs

2016-03-19 Thread Johannes Pfau via Digitalmars-d
Am Thu, 17 Mar 2016 20:27:39 + schrieb bitwise : > I've been doing some work on shared libraries for OSX, and have > come across a potential problem, which I'm not sure what to do > with. > > Currently, when a thread is spawned, that thread calls all the > TLS

Re: static ctors in shared libs

2016-03-19 Thread Jacob Carlborg via Digitalmars-d
On 17/03/16 21:27, bitwise wrote: I've been doing some work on shared libraries for OSX, and have come across a potential problem, which I'm not sure what to do with. Currently, when a thread is spawned, that thread calls all the TLS ctors, then runs the thread entry point function, and finally

Re: static ctors in shared libs

2016-03-18 Thread Johannes Pfau via Digitalmars-d
Am Fri, 18 Mar 2016 14:35:41 + schrieb Marc Schütz : > On Thursday, 17 March 2016 at 20:54:57 UTC, Johannes Pfau wrote: > > It's been some time since I looked at that code, but IIRC TLS > > ctors for newly loaded libraries are not run in old threads. > > There's nothing we