betterC and core.stdc modules; betterC and varargs routines
ryuukk_
ryuukk.dev at gmail.com
Fri Oct 11 05:39:06 UTC 2024
```D
import core.stdc.stdarg;
// add this
extern(C) void va_end(void* ap){}
pragma(printf)
public extern(C) int wrap_printf(scope const char* f, ...) {
import core.stdc.stdio;
va_list ap;
va_start(ap, f);
auto rc = vprintf(f, ap);
va_end(ap);
return rc;
}
extern(C) void main(int argc, const(char)** argv)
{
wrap_printf("Foo\n");
}
```
Adding: `extern(C) void va_end(void* ap){}` works for me, looks
like DMD doesn't do its job properly
If -betterC can't do what C does, then it's not -betterC, but
-worseC
To me this is a bug and it should be reported
More information about the Digitalmars-d
mailing list