Hi folks,

The example of setting up a Win32 program in D is a great starting point, but I have a concern about manually setting up and tearing down the D runtime.

If myWinMain throws an exception that isn't caught, then it is caught in WinMain instead. This causes us to miss the call to RunTime.terminate(...).

My solution was to call RunTime.terminate in a scope(exit) block, which assures that terminate would be called. This still doesn't seem fully correct, since we ignore the return value of initialise and terminate, which complicates things a bit more. If I were to throw on a false from initialise then I would call terminate (obviously not good...)

Ultimately my question is: Is there a "safer" way to start a Win32 program, or should I assume that myWinMain cannot throw?

D is still relatively new to me, so I chances are high I missed something obvious :)

/Dave

Reply via email to