1 /* { dg-do run } */
2
3 #include "ffitest.h"
4
doit(ffi_cif * cif,void * rvalue,void ** avalue,void * closure)5 void doit(ffi_cif *cif, void *rvalue, void **avalue, void *closure)
6 {
7 (void)cif;
8 (void)avalue;
9 *(void **)rvalue = closure;
10 }
11
12 typedef void * (*FN)(void);
13
main()14 int main()
15 {
16 ffi_cif cif;
17 ffi_go_closure cl;
18 void *result;
19
20 CHECK(ffi_prep_cif(&cif, ABI_NUM, 0, &ffi_type_pointer, NULL) == FFI_OK);
21 CHECK(ffi_prep_go_closure(&cl, &cif, doit) == FFI_OK);
22
23 ffi_call_go(&cif, FFI_FN(*(FN *)&cl), &result, NULL, &cl);
24
25 CHECK(result == &cl);
26
27 exit(0);
28 }
29