In Phobos' etc/c/zlib/gzwrite.c file there is a workaround: --- // needed on Win64 - MS __va_start intrinsic not supported by importC yet #if __IMPORTC__ __builtin_va_start(va, format); #else va_start(va, format); #endif --- See https://github.com/dlang/phobos/pull/8865#issuecomment-1862006408 --- Argh, the Microsoft headers use something like this (`vadefs.h`) for x86_64: ```c void __cdecl __va_start(va_list* , ...); #define __crt_va_start_a(ap, x) ((void)(__va_start(&ap, x))) ``` The signature of their intrinsic isn't compatible with druntime's `va_start` (which takes the first param as `out` ref, not as explicit pointer), so I sadly don't see a way to handle this in druntime's `__builtins.di` (or `importc.h`). ---
@WalterBright updated dlang/dlang.org pull request #3752 "fix Issue 24312 - importC: Document workaround for using C symbols wh…" fixing this issue: - fix Issue 24310 - importC: Document workaround for using C symbols which are also D keywords https://github.com/dlang/dlang.org/pull/3752
(In reply to Dlang Bot from comment #1) > https://github.com/dlang/dlang.org/pull/3752 Ignore that. It was meant for another issue.
Currently, 1. there is no va_start in importc.h 2. in __builtins.di there is: alias __builtin_va_start = imported!"core.stdc.stdarg".va_start; 3. in Microsoft's stdarg.h there is: #define va_start __crt_va_start 4. in core.stdc.stdarg there is: void va_start(T)(out va_list ap, ref T parmn); va_start() is an intrinsic built in to dmd. Is __va_start() a Microsoft intrinsic?
I suspect it might work if we added to stdarg.d: void __va_start(T)(va_list* ap, ref T parmn) { va_start(*ap, parmn); } and to __builtins.di: alias __va_start = imported!"core.stdc.stdarg".__va_start;
dlang/dlang.org pull request #3752 "fix Issue 24310 - importC: Document workaround for using C symbols wh…" was merged into master: - 078629cbca561a697cb380481bcce6744c0a07ef by Walter Bright: fix Issue 24310 - importC: Document workaround for using C symbols which are also D keywords https://github.com/dlang/dlang.org/pull/3752
Issue was linked to the wrong PR
(In reply to Walter Bright from comment #4) > I suspect it might work if we added to stdarg.d: > > void __va_start(T)(va_list* ap, ref T parmn) > { > va_start(*ap, parmn); > } > > and to __builtins.di: > > alias __va_start = imported!"core.stdc.stdarg".__va_start; I doubt it - this would probably need to be force-inlined at the AST level to work properly.