ImportC now supports function-like macros
Dakota
dakota at gmail.com
Wed Feb 28 05:26:51 UTC 2024
On Tuesday, 20 February 2024 at 02:07:45 UTC, Walter Bright wrote:
> #importc now successfully converts function-like C macros to
> #dlang function templates:
>
> ```C
> #define ADD(a, b) a + b
> ```
>
> is converted to a D function template:
>
> ```D
> auto ADD(T1, T2)(T1 a, T2 b) { return a + b; }
> ```
>
> which opens up a lot more automatic support for C macro use.
>
> https://github.com/dlang/dmd/pull/16199
>
> Thanks to @ibuclaw, @dkorpel, @thewilsonator, @Herringway,
> @ntrel, @tim-dlang for helping me get it over the finish line.
Hi Walter, Thanks for the great work.
I want to ask you to speedup the process for this ImportC issue:
https://issues.dlang.org/show_bug.cgi?id=23926
I am use importC for a huge C header(700KB), with dmd nightly
most of code work well.
without fix
[#23926](https://issues.dlang.org/show_bug.cgi?id=23926), there
is no easy way to fix this huge c code header that change
constantly by upstream, this header is generate by amalgamation
scripts.
There is 14K lines code, and so much function that accept
nont-const struct pointer mixed const struct pointer. It is not
impractical to add so much `cast(Message*)` into D code.
Please let me know what I can do to speedup the process to fix
this problem.
Thanks in advance.
More information about the Digitalmars-d
mailing list