Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact

Cannot build Win32 applications

Moderators: kris

Posted: 02/10/10 15:48:09

I was using DMD 1.056 with about month-two old snapshot. After upgrading to 0.99.9 my application stopped to build. It is very strange, that only when the "foreach" statement is included, I get following error:

OPTLINK : Warning 183: Extension not .RES : tango.lib C:\Soft\D\tango\bin\..\lib\tango.lib(dmain2)

Error 42: Symbol Undefined Dmain

test code:

file "main.d": module main;

extern (C) {

void gc_init (); void gc_term (); void _minit (); void _moduleCtor (); void _moduleDtor ();


extern (Windows) int WinMain? ( void* hInstance, void* hPrevInstance, char* lpCmdLine, int nCmdShow) {

gc_init (); _minit ();

try {

_moduleCtor (); _moduleDtor ();

foreach (ch; "abc") {} // This line causes error.

} catch (Object o) { }

gc_term ();

return 1;


I used the following def file "main.def": EXETYPE NT SUBSYSTEM WINDOWS

and command line: dmd main.d main.def

This exact code compiles under DMD+Phobos 1.056

This is for me critical problem, because I cannot build any file / tango file that use foreach.

I suppose this is some runtime initialization problem...

Author Message

Posted: 02/10/10 16:39:04

Hi Michal! Could you please create a ticket?