Operaror 'new' inside WinMain crashes at runtime

Serg Kovrov kovrov at no.spam
Thu Aug 10 01:28:08 PDT 2006


* Derek Parnell:
> Confirmed. However this is not the way to write Windows apps. You missed
> out all the GC stuff. The code should look like this ...

Thanks for pointing that, Derek. It is silly of me that I forgot about 
that =)

But isn't it tedious to type/copy this for every new windows program one 
start to write?

And appears to me, this is some inner GC stuff that might me changed at 
some point. If so, maybe this should not be used directly by application 
programmer? I believe it is better to have compiler/standard library to 
do it instead. Just like it does for main() function.

Even better, if application programmer do always write main(), but if in 
.def there is 'SUBSYSTEM WINDOWS' string, compiler/standard library 
substitutes it with proper entry point with proper inners stuff 
initialization.

Or even better than better, is to omit .def files and have some pragmas 
in source file instead? Resulting programs could be more 
portable/deployable then...



More information about the Digitalmars-d-bugs mailing list