Windows Bindings v1.0

Rumbu rumbu at rumbu.ro
Thu Feb 18 08:44:50 UTC 2021


On Wednesday, 17 February 2021 at 20:53:49 UTC, tchaloupka wrote:
> On Tuesday, 16 February 2021 at 08:45:19 UTC, Rumbu wrote:
>> The D Windows SDK projection reached first version. Generated 
>> bindings were compiled succesfully.
>>
>> https://github.com/rumbu13/windows-d
>>
>> Destroy!
>
> Thanks for this, looks great.
> Could the generated code be annotated with nothrow @nogc too?
>
> Tom

I don't know what to say about nothrow. There are WinAPI 
functions generating exceptions. For example the code below 
trying to allocate size_t.max bytes, even we reserved 10 only:

auto h = HeapCreate(4, 10, 10);
auto p = HeapAlloc(h, 4, size_t.max);

Now, the D runtime catches internally any Windows exception and 
throws a generic Win32 Error without any other information, and 
of course, this will qualify HeapAlloc as a nothrow function.

In reality, this should not be just an uncatchable Error, but a 
full Exception object having the associated error code 
(0xC0000017), the associated default message ("Not Enough Quota") 
and the value of the offending parameter (0xFFFFFFFF). All this 
information is available in SEH records but it is ignored by D 
runtime.


More information about the Digitalmars-d-announce mailing list