[Issue 24505] [REG2.108] ImportC: Function-like macros (newly translated to templates) may collide with regular symbols

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Apr 17 11:28:38 UTC 2024


https://issues.dlang.org/show_bug.cgi?id=24505

--- Comment #4 from kinke <kinke at gmx.net> ---
(In reply to anonymous4 from comment #3)
> Looks like a generic problem. How posix stat should work?

It is a generic problem, one that we cannot solve elegantly in D/importC - we
don't have an ugly 2-stage compilation like C(++), with preprocessor 'symbols'.
But we need to be able to deal with this. In this concrete case, our interop
code doesn't use `stat` in D at all, it's a totally uninteresting symbol, like
~99% of the C symbols dragged in by ~400k preprocessed lines.

If one indeed depended on the `stat` macro, a solution could be to add a little
wrapper in the .c file, letting the preprocessor do its magic, and then
aliasing `stat` to that custom wrapper in the .d file importing the .c file.

--


More information about the Digitalmars-d-bugs mailing list