5 static _Complex T_C_TYPE f_complex(_Complex T_C_TYPE c, int x, int *py)
7 c = -(2 * creal (c)) + (cimag (c) + 1)* I;
16 ffi_type *args[MAX_ARGS];
17 void *values[MAX_ARGS];
19 _Complex T_C_TYPE tc_arg;
20 _Complex T_C_TYPE tc_result;
23 int *tc_ptr_arg_y = &tc_y;
25 args[0] = &T_FFI_TYPE;
26 args[1] = &ffi_type_sint;
27 args[2] = &ffi_type_pointer;
29 values[1] = &tc_int_arg_x;
30 values[2] = &tc_ptr_arg_y;
32 /* Initialize the cif */
33 CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 3,
34 &T_FFI_TYPE, args) == FFI_OK);
39 ffi_call(&cif, FFI_FN(f_complex), &tc_result, values);
41 printf ("%f,%fi %f,%fi, x %d 1234, y %d 11110\n",
42 T_CONV creal (tc_result), T_CONV cimag (tc_result),
43 T_CONV creal (2.0), T_CONV creal (8.0), tc_int_arg_x, tc_y);
45 CHECK (creal (tc_result) == -2);
46 CHECK (cimag (tc_result) == 8);
47 CHECK (tc_int_arg_x == 1234);
48 CHECK (*tc_ptr_arg_y == 11110);