extern (C) void variadic(int* p, int x, int y, int z, const char *fmt, ...) {
import core.stdc.stdarg;
import core.stdc.stdio;
va_list args;
va_start(args, fmt);
foreach (_; 0..2) {
char* c;
va_arg(args, c);
printf("%s\n", c);
}
va_end(args);
}
void main() {
variadic(null, 0, 0, 0, "%s %s", "one".ptr, "two".ptr);
}
This should print:
one
two
On Windows, this works correctly in a 32-bit build. When compiled with -m64 flag, this prints:
%s %s
one
Tinkering with parameters preceding `fmt` affects the output.
Comment #1 by robert.schadek — 2024-12-13T19:25:44Z