Error: WndProc - nothrow
Simon
s.d.hammett at gmail.com
Mon Sep 17 14:31:09 PDT 2012
On 16/09/2012 23:32, cal wrote:
> On Sunday, 16 September 2012 at 22:08:53 UTC, deed wrote:
>> Exactly. I couldn't remember seeing this error before.
>
> I've only used the dsource Win32 bindings, because there is often stuff
> missing from the phobos ones:
>
> http://www.dsource.org/projects/bindings/wiki/WindowsApi
>
> But I don't understand the reason for the change to the phobos bindings.
> Like someone above said, the easiest solution is to wrap your wndProc
> body in a try/catch.
A window proc is being called directly by Win32 which expects that the
wndproc is a strict C function. You MUST NOT allow a D exception to
propagate out of the wndproc (or indeed any other Win32 callback
function) as the Win32 calling code has no idea how to process it and
you'll just get a crash.
Also the crash address that you get will be in a windows system dll
which will just confuse matters when you try and debug the problem.
So yes, the correct thing to do is wrap all D code in try catch block.
--
My enormous talent is exceeded only by my outrageous laziness.
http://www.ssTk.co.uk
More information about the Digitalmars-d-learn
mailing list