Why is the Win32 boilerplate the way it is?
Jeremy Sorensen via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sun Jun 29 08:06:23 PDT 2014
On Sunday, 29 June 2014 at 07:51:50 UTC, Jacob Carlborg wrote:
>
> You don't need to use WinMain. You can use a plain D main
> function and add the "-L/SUBSYSTEM:WINDOWS:4.0" link flag to
> suppress the console. There are API's to get access to the
> arguments passed to WinMain, if necessary.
OK so I just tried this and found some amazing things. By using
main instead of WinMain the std runtime is automatically loaded,
and uncaught exceptions are not swallowed up like in WinMain, so
you don't need the try-catch anymore! This makes life much
better. The only question I have is what happens when you use
SUBSYSTEM:WINDOWS:4.0 (Which I understand means XP or higher) and
the program runs on something older? Will you get an error
message or just silent failure?
More information about the Digitalmars-d-learn
mailing list