Skip to content

Instantly share code, notes, and snippets.

@fowlmouth
Created May 8, 2015 07:05
Show Gist options
  • Save fowlmouth/000cb78b33b1fe2a95fd to your computer and use it in GitHub Desktop.
Save fowlmouth/000cb78b33b1fe2a95fd to your computer and use it in GitHub Desktop.
{.emit:"""
#include <stdarg.h>
void foobar(int i, ...) {
va_list args;
int j;
va_start(args, i);
for (j = 0; j < i; j++) {
int x = va_arg(args, int);
printf("%i\n", x);
}
va_end(args);
}
""".}
proc foobar(i:cint) {.importc, varargs.}
proc barfoo(nums:varargs[cint]) =
foobar(nums.len.cint, nums, -1i32, -2i32)
barfoo(1, 2, 3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment