static constructor not working with WinMain GUI app

Andrej Mitrovic none at none.none
Tue Nov 23 12:23:12 PST 2010


maintest.def:
EXETYPE NT
SUBSYSTEM WINDOWS

maintest.d:
http://pastebin.com/3c4CKDG1

Compiled with DMD 2.050: 
dmd maintest.d maintest.def

The output in the log file is "Lenght: 0". The static constructor is never called when using WinMain.

But if I use a normal "void main()" function instead of WinMain, then the static constructor does get called. Here's a working example that tests a GUI dialogbox and outputs "Length: 4" in the log file:

maintest.def:
EXETYPE NT
SUBSYSTEM WINDOWS

maintest.d:
http://pastebin.com/3UDKmxJ1

dmd maintest.d maintest.def

This looks like a bug to me..


More information about the Digitalmars-d-learn mailing list