[Issue 24310] New: ImportC: varargs from Microsoft header incompatible with va_start
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Dec 31 13:18:08 UTC 2023
https://issues.dlang.org/show_bug.cgi?id=24310
Issue ID: 24310
Summary: ImportC: varargs from Microsoft header incompatible
with va_start
Product: D
Version: D2
Hardware: All
OS: Windows
Status: NEW
Keywords: ImportC
Severity: normal
Priority: P3
Component: dmd
Assignee: nobody at puremagic.com
Reporter: dkorpel at live.nl
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`).
---
--
More information about the Digitalmars-d-bugs
mailing list