Skip to content

Commit

Permalink
zlib: Add importC special case for va_start() on Win64
Browse files Browse the repository at this point in the history
This fixes an undefined `__va_start` symbol for the zlib parts,
a problem on Win64 only so far.

The Microsoft headers use something like this (`vadefs.h`) for
x86_64:

```
void __cdecl __va_start(va_list* , ...);
```

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`).
  • Loading branch information
kinke committed Dec 19, 2023
1 parent d49d0c5 commit 95f0956
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions etc/c/zlib/gzwrite.c
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,12 @@ int ZEXPORTVA gzprintf(gzFile file, const char *format, ...)
va_list va;
int ret;

// 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
ret = gzvprintf(file, format, va);
va_end(va);
return ret;
Expand Down

0 comments on commit 95f0956

Please sign in to comment.