digitalmars.D - __gshared this()
- Manu via Digitalmars-d (27/27) Jul 21 2014 I has problems:
- Jacob Carlborg (4/6) Jul 21 2014 What would that do? I didn't know that was possible to do.
- Manu via Digitalmars-d (7/14) Jul 22 2014 We have:
- David Nadlinger (6/8) Jul 22 2014 "shared static this()" (or the other b way round, can never
- Manu via Digitalmars-d (5/12) Jul 22 2014 Oh wow, I'm an idiot. Not sure how I missed that... and I've even used i...
- Manu via Digitalmars-d (3/19) Jul 22 2014 Might I suggest some helpful error messages in these cases where the use...
- Peter Alexander (4/7) Jul 22 2014 You may :-)
- Peter Alexander (4/9) Jul 22 2014 shared static this() { ... }
I has problems: class T { __gshared int global; int member; this() { member = global; } __gshared this() { global = 10; } } fatal error LNK1179: invalid or corrupt file: duplicate COMDAT '_D2db2ui2ui1T6__ctorMFZC2db2ui2ui1T (db.ui.ui.T db.ui.ui.T.__ctor())' Further, if I write this code: void f() { T t = new T; } Error: db.ui.ui.T.__ctor called with argument types () matches both: db.ui.ui.T.this() and: db.ui.ui.T.this() It seems __gshared constructors aren't working... although I thought they did; I'm sure I've used them before in various occasions :/
Jul 21 2014
On 22/07/14 08:25, Manu via Digitalmars-d wrote:It seems __gshared constructors aren't working... although I thought they did; I'm sure I've used them before in various occasions :/What would that do? I didn't know that was possible to do. -- /Jacob Carlborg
Jul 21 2014
We have: this() // instance constructor static this() // thread-local static constructor But what I need is: __gshared this() // not-thread-local static constructor (?) On 22 July 2014 16:31, Jacob Carlborg via Digitalmars-d < digitalmars-d puremagic.com> wrote:On 22/07/14 08:25, Manu via Digitalmars-d wrote: It seems __gshared constructors aren't working... although I thoughtthey did; I'm sure I've used them before in various occasions :/What would that do? I didn't know that was possible to do. -- /Jacob Carlborg
Jul 22 2014
On Tuesday, 22 July 2014 at 07:27:46 UTC, Manu via Digitalmars-d wrote:But what I need is: __gshared this() // not-thread-local static constructor"shared static this()" (or the other b way round, can never remember). Cheers, David
Jul 22 2014
On 22 July 2014 17:47, David Nadlinger via Digitalmars-d < digitalmars-d puremagic.com> wrote:On Tuesday, 22 July 2014 at 07:27:46 UTC, Manu via Digitalmars-d wrote:Oh wow, I'm an idiot. Not sure how I missed that... and I've even used it before in various occasions! Sorry for the noise! >_<But what I need is: __gshared this() // not-thread-local static constructor"shared static this()" (or the other b way round, can never remember). Cheers, David
Jul 22 2014
On 22 July 2014 18:26, Manu <turkeyman gmail.com> wrote:On 22 July 2014 17:47, David Nadlinger via Digitalmars-d < digitalmars-d puremagic.com> wrote:Might I suggest some helpful error messages in these cases where the user tries to do something stupid like this? :)On Tuesday, 22 July 2014 at 07:27:46 UTC, Manu via Digitalmars-d wrote:Oh wow, I'm an idiot. Not sure how I missed that... and I've even used it before in various occasions! Sorry for the noise! >_<But what I need is: __gshared this() // not-thread-local static constructor"shared static this()" (or the other b way round, can never remember). Cheers, David
Jul 22 2014
On Tuesday, 22 July 2014 at 08:33:57 UTC, Manu via Digitalmars-d wrote:Might I suggest some helpful error messages in these cases where the user tries to do something stupid like this? :)You may :-) https://issues.dlang.org/
Jul 22 2014
On Tuesday, 22 July 2014 at 07:27:46 UTC, Manu via Digitalmars-d wrote:We have: this() // instance constructor static this() // thread-local static constructor But what I need is: __gshared this() // not-thread-local static constructor (?)shared static this() { ... } http://dlang.org/class#SharedStaticConstructor
Jul 22 2014