https://issues.dlang.org/show_bug.cgi?id=22367
--- Comment #9 from Walter Bright <bugzi...@digitalmars.com> --- Iain has the right idea. The solution is to, when in -betterC mode: 1. automatically annotate static constructors with: pragma(crt_constructor) extern (C) 2. do the same for static destructors 3. not set `needmoduleinfo` for (1) and (2) This will run the constructors and destructors using the C runtime library mechanism. The downside of this is the order of construction and destruction will be in the order the object files are seen by the linker, rather than a depth-first hierarchical order. ---- Mathias' suggestion is a good one. Give an error on `static this()`, and only work with `shared static this()`. --