-
Notifications
You must be signed in to change notification settings - Fork 5
/
calltest_386.go
68 lines (53 loc) · 997 Bytes
/
calltest_386.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
// Copyright 2013 Mikkel Krautz. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package variadic
import "unsafe"
/*
#include <stdarg.h>
void *arg0(void *arg0, ...) {
return arg0;
}
void *argN(int n, ...) {
va_list v;
va_start(v, n);
int skip = n-1;
while (skip > 0) {
va_arg(v, void *);
skip--;
}
void *val = va_arg(v, void *);
return val;
}
void *arg0fn() {
return arg0;
}
void *argNfn() {
return argN;
}
float floatret(void *arg0) {
return 3.141592f;
}
void *floatretfn() {
return floatret;
}
double doubleret(void *arg0) {
return 3.141592;
}
void *doubleretfn() {
return doubleret;
}
*/
import "C"
func arg0fn() unsafe.Pointer {
return unsafe.Pointer(C.arg0fn())
}
func argNfn() unsafe.Pointer {
return unsafe.Pointer(C.argNfn())
}
func floatret() unsafe.Pointer {
return unsafe.Pointer(C.floatretfn())
}
func doubleret() unsafe.Pointer {
return unsafe.Pointer(C.doubleretfn())
}