Operaror 'new' inside WinMain crashes at runtime

Serg Kovrov kovrov at no.spam
Tue Aug 8 17:12:47 PDT 2006


Consider this sample:
> import std.c.windows.windows;
> 
> class Test {}
> 
> extern (Windows)
> int WinMain(HINSTANCE instance, HINSTANCE prevInstance, LPSTR cmdLine, int cmdShow)
> {
> 	new Test(); // <-- here
> 	return 0;
> }

When running executable got a runtime error. There is some info/dump on 
the error, but I can't save/copy it. This is part of it: Exception 
Information - code: 0xc0000005; Flags: 0x00000000; record: 
0x0000000000000000; Address: 0x0000000000402be5; and some system 
information, followed lots of modules information...

This only occurs within WinMain program. eg console
application (with 'main()' entry) did not reproduce this error.

Compiled with: `dmd test.d gdi32.lib test.def`
test.def is standard windows def:
> EXETYPE NT
> SUBSYSTEM WINDOWS

Can anyone confirm this?

-- 
serg.



More information about the Digitalmars-d-bugs mailing list