← Back to index
|
Original Bugzilla link
Bug 2673 – Static constructors sometimes do not run when compiling with -lib
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2009-02-17T16:53:00Z
Last change time
2015-06-09T01:31:23Z
Assigned to
bugzilla
Creator
bugzilla
Comments
Comment #0
by bugzilla — 2009-02-17T16:53:24Z
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
Comment #1
by bugzilla — 2009-03-11T14:53:53Z
Fixed dmd 1.041 and 2.026