summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharlie Savage <cfis@savagexi.com>2023-04-20 00:44:45 -0700
committerCharlie Savage <cfis@savagexi.com>2023-04-20 10:24:50 -0700
commit75ff5ddcd39ed0ab5030ca7d3a9b200347b579b2 (patch)
tree60b2a47031ea593b0311d286ac1db84323eaa601
parent4de2bc1b1db4d3109d54d2b58ba433e2574fa675 (diff)
downloadffi-75ff5ddcd39ed0ab5030ca7d3a9b200347b579b2.tar.gz
Visual Studio 22 does not compile va_arg that are function pointers. Instead, the function pointers must be a typdef. For what its worth, see https://stackoverflow.com/a/37114318.
-rw-r--r--spec/ffi/fixtures/ClosureTest.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/spec/ffi/fixtures/ClosureTest.c b/spec/ffi/fixtures/ClosureTest.c
index 16f72c4..47273e8 100644
--- a/spec/ffi/fixtures/ClosureTest.c
+++ b/spec/ffi/fixtures/ClosureTest.c
@@ -16,10 +16,10 @@
double testClosureVrDva(double d, ...) {
va_list args;
- double (*closure)(void);
+ typedef double (*closure_fun)(void);
va_start(args, d);
- closure = va_arg(args, double (*)(void));
+ closure_fun closure = va_arg(args, closure_fun);
va_end(args);
return d + closure();
@@ -27,12 +27,12 @@ double testClosureVrDva(double d, ...) {
long testClosureVrILva(int i, long l, ...) {
va_list args;
- int (*cl1)(int);
- long (*cl2)(long);
+ typedef int (*cl1_fun)(int);
+ typedef long (*cl2_fun)(long);
va_start(args, l);
- cl1 = va_arg(args, int (*)(int));
- cl2 = va_arg(args, long (*)(long));
+ cl1_fun cl1 = va_arg(args, cl1_fun);
+ cl2_fun cl2 = va_arg(args, cl2_fun);
va_end(args);
return cl1(i) + cl2(l);