nothrow in druntime win32 C bindings
Walter Bright
newshound2 at digitalmars.com
Wed Dec 26 14:33:51 PST 2012
On 12/26/2012 2:12 PM, Andrej Mitrovic wrote:
> All contents in the core.sys.windows.windows module in 2.061 are
> marked as nothrow.
>
> nothrow means exceptions derived from the Exception class are not
> allowed to propagate. In other words now that the WNDPROC function
> pointer is expected to be nothrow you have to wrap any statements
> which might throw Exception objects in a try/catch block.
>
> SEH[1] is implemented in D for x86 (x64 not yet, but maybe some day),
> therefore exceptions can propagate, and they do as this sample will
> show you if you compile it with 2.060:
> https://github.com/AndrejMitrovic/dmd/blob/662db08ce9dd27d2c79d04ab4ccea9823f6142a1/test/win32/testthrow.d#L23
>
> Are there problems with the SEH implementation which forces us to use
> nothrow on win32? If there are then this should be documented.
>
The operating system calls WNDPROC directly. That means that you (the user) need
to set up / tear down the D runtime yourself, much like what C main() does in
druntime. Windows has no knowledge of D Exceptions, and it makes no sense to me
to try to pass them on to Windows. WNDPROC should deal with them.
More information about the Digitalmars-d
mailing list