nothrow in druntime win32 C bindings
Andrej Mitrovic
andrej.mitrovich at gmail.com
Wed Dec 26 14:47:17 PST 2012
On 12/26/12, Walter Bright <newshound2 at digitalmars.com> wrote:
> The operating system calls WNDPROC directly. That means that you (the user)
> need to set up / tear down the D runtime yourself
But we already do this in WinMain, which is called first:
extern (Windows)
int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR
lpCmdLine, int iCmdShow)
{
int result;
void exceptionHandler(Throwable e) { throw e; }
try
{
Runtime.initialize(&exceptionHandler);
result = myWinMain(hInstance, hPrevInstance, lpCmdLine, iCmdShow);
Runtime.terminate(&exceptionHandler);
}
catch (Throwable o)
{
MessageBox(null, o.toString().toUTF16z, "Error", MB_OK |
MB_ICONEXCLAMATION);
result = 0;
}
return result;
}
This is the top-level exception handler where exceptions from within a
WNDPROC propagate to if they're not caught.
More information about the Digitalmars-d
mailing list