http://d.puremagic.com/issues/show_bug.cgi?id=2673
Summary: Static constructors sometimes do not run when compiling with -lib Product: D Version: unspecified Platform: PC OS/Version: Windows Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: bugzi...@digitalmars.com ReportedBy: bugzi...@digitalmars.com Tom S. writes: This one still has problems. ---- Main.d: import Mod; void main() { foo(); } ---- Mod.d: import Mod2; extern (C) int printf(char*, ...); void foo() { foo2(); } static this() { printf("Running a static ctor for Mod"\n); } ---- Mod2.d: extern (C) int printf(char*, ...); void foo2() { } static this() { printf("Running a static ctor for Mod2"\n); } ---- Compiling these modules as: dmd -c Main.d dmd -lib Mod.d Mod2.d dmd Main.obj Mod.lib ... and running Main.exe yields: Running a static ctor for Mod --