Information about the 'magic' field in object.Object class
kinke
kinke at gmx.net
Thu Jan 16 17:39:32 UTC 2020
On Thursday, 16 January 2020 at 15:28:06 UTC, realhet wrote:
> Update:
> - All of the child classes needed to be marked with extern(C++)
> - static class members are not supported, only __gshared static.
> - passing a delegate to a constructor of this class expects a
> (extern(C++) delegate) too.
> - Internal compiler error: string[string] can not be mapped to
> C++
>
> So extern(C++) is not good in the current case.
The 3 latter points can be trivially worked around via extern(D):
extern(C++) class C
{
extern(D):
static int tlsGlobal;
this(void delegate()) {}
void foo(string[string] aa) {}
}
void main()
{
C.tlsGlobal = 123;
auto c = new C(() {});
c.foo(null);
}
> I will not do any synchronization, but I think the GC will
> crash upon releasing these objects.
Very likely.
More information about the Digitalmars-d-learn
mailing list