[Issue 2673] New: Static constructors sometimes do not run when compiling with -lib
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Feb 17 14:53:23 PST 2009
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: bugzilla at digitalmars.com
ReportedBy: bugzilla at 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
--
More information about the Digitalmars-d-bugs
mailing list