ImportC and nothrow/@nogc?
Stefan Koch
uplink.coder at googlemail.com
Thu Aug 29 19:32:06 UTC 2024
On Thursday, 29 August 2024 at 18:39:23 UTC, Tim wrote:
> On Sunday, 18 August 2024 at 04:43:34 UTC, Manu wrote:
>> I just tried using ImportC for the first time ever, but I was
>> surprised
>> when I immediately received a sea of errors calling the C
>> symbols from
>> `nothrow @nogc` functions.
>> My entire program is `nothrow @nogc`... I assumed ImportC
>> would be
>> supremely suitable in this context, but apparently not...
>>
>> Is there something I've missed? Is there a plan for this?
>> I found just one single very short forum thread...
>>
>> This is classic D experience; so much work has been done on
>> this, and then the moment I try and use something I encounter
>> a showstopping oversight >_<
>
> Here is a pull request for a new ImportC pragma, which allows
> to set `nothrow`, `@nogc` and `pure`:
> https://github.com/dlang/dmd/pull/16820
That requires modification of the C header.
maybe using the attribute on the import is a better idea.
Perhaps it is reasonable to have both, but I can imagine people
not wanting to change their headers.
More information about the Digitalmars-d
mailing list