Is it possible to call all shared static ctors in betterC?
//-betterC
static immutable int i;
shared static this(){
i = 42;
}
extern(C) void main(){
assert(i != 42);
}
Thread overview | ||||||
---|---|---|---|---|---|---|
|
July 21, 2021 betterC shared static ctor | ||||
---|---|---|---|---|
| ||||
Is it possible to call all shared static ctors in betterC?
|
July 21, 2021 Re: betterC shared static ctor | ||||
---|---|---|---|---|
| ||||
Posted in reply to vit | On Wednesday, 21 July 2021 at 08:02:42 UTC, vit wrote: >Is it possible to call all shared static ctors in betterC?
Sorry, wrong forum section. |
July 21, 2021 Re: betterC shared static ctor | ||||
---|---|---|---|---|
| ||||
Posted in reply to vit | On Wednesday, 21 July 2021 at 08:02:42 UTC, vit wrote: >Is it possible to call all shared static ctors in betterC?
Static module constructors and destructors are not available with betterC unfortunately. As described here: |
July 21, 2021 Re: betterC shared static ctor | ||||
---|---|---|---|---|
| ||||
Posted in reply to vit | On 7/21/21 4:02 AM, vit wrote: >Is it possible to call all shared static ctors in betterC?
You can use C runtime constructors. However, the compiler doesn't recognize this as a static ctor exactly, so
-Steve |