6 return_c(_Complex T_C_TYPE c1, _Complex T_C_TYPE c2,
7 unsigned int in3, _Complex T_C_TYPE c4)
9 volatile _Complex T_C_TYPE r = c1 + c2 + in3 + c4;
16 ffi_type *args[MAX_ARGS];
17 void *values[MAX_ARGS];
18 _Complex T_C_TYPE c1, c2, c4, rc, rc2;
20 args[0] = &T_FFI_TYPE;
21 args[1] = &T_FFI_TYPE;
22 args[2] = &ffi_type_uint;
23 args[3] = &T_FFI_TYPE;
29 /* Initialize the cif */
30 CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 4,
31 &T_FFI_TYPE, args) == FFI_OK);
32 c1 = 127.0 + 255.0 * I;
35 c4 = 512.7 + 1024.1 * I;
37 ffi_call(&cif, FFI_FN(return_c), &rc, values);
38 rc2 = return_c(c1, c2, in3, c4);
39 printf ("%f,%fi vs %f,%fi\n",
40 T_CONV creal (rc), T_CONV cimag (rc),
41 T_CONV creal (rc2), T_CONV cimag (rc2));