August 30

On Friday, 30 August 2024 at 10:20:07 UTC, Atila Neves wrote:

>

On Thursday, 29 August 2024 at 19:50:10 UTC, Steven Schveighoffer wrote:

[snip]

Except you can't, because it's a C file, not D. What am I missing?

There was a lot of back and forth last year about having importC recognize .h files.

Initial bug report here: https://issues.dlang.org/show_bug.cgi?id=23479
PRs about it: https://github.com/dlang/dmd/pulls?q=is%3Apr+23479+

The result is that if there is some C header that you want to use, you have to make a .c file to include it and then import that with importC.

August 30

On Friday, 30 August 2024 at 10:20:07 UTC, Atila Neves wrote:

>

On Thursday, 29 August 2024 at 19:50:10 UTC, Steven Schveighoffer wrote:

>

On Thursday, 29 August 2024 at 19:32:06 UTC, Stefan Koch wrote:

>

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.

You can't import headers with importC. You have to import C files.

It is already necessary to create shim C files.

So in the shim, you set the attributes, and import the headers you need.

Except you can't, because it's a C file, not D. What am I missing?

From the original message that Stefan responded to:

>

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

-Steve

1 2 3 4 5 6 7 8 9
Next ›   Last »