19 result.
a = a1.
a + a2.
a;
20 result.
b = a1.
b + a2.
b;
21 result.
c = a1.
c + a2.
c;
24 printf(
"%g %g %g %g %g %g: %g %g %g\n", a1.
a, a1.
b, a1.
c,
25 a2.
a, a2.
b, a2.
c, result.
a, result.
b, result.
c);
45 ffi_type* my_ffi_struct_fields[4];
46 ffi_type my_ffi_struct_type;
49 ffi_closure *pcl = ffi_closure_alloc(
sizeof(ffi_closure), &code);
51 ffi_type* arg_types[3];
57 my_ffi_struct_type.size = 0;
58 my_ffi_struct_type.alignment = 0;
59 my_ffi_struct_type.type = FFI_TYPE_STRUCT;
60 my_ffi_struct_type.elements = my_ffi_struct_fields;
62 my_ffi_struct_fields[0] = &ffi_type_double;
63 my_ffi_struct_fields[1] = &ffi_type_double;
64 my_ffi_struct_fields[2] = &ffi_type_double;
65 my_ffi_struct_fields[3] =
NULL;
67 arg_types[0] = &my_ffi_struct_type;
68 arg_types[1] = &my_ffi_struct_type;
72 arg_types) == FFI_OK);
79 printf(
"res: %g %g %g\n", res.
a, res.
b, res.
c);
86 printf(
"res: %g %g %g\n", res.
a, res.
b, res.
c);
ffi_status ffi_prep_closure_loc(ffi_closure *closure, ffi_cif *cif, void(*fun)(ffi_cif *, void *, void **, void *), void *user_data, void *codeloc)
void ffi_call(ffi_cif *cif, void(*fn)(void), void *rvalue, void **avalue)
ffi_status ffi_prep_cif(ffi_cif *cif, ffi_abi abi, unsigned int nargs, ffi_type *rtype, ffi_type **atypes)
struct my_ffi_struct my_ffi_struct
my_ffi_struct callee(struct my_ffi_struct a1, struct my_ffi_struct a2)
void stub(ffi_cif *cif __UNUSED__, void *resp, void **args, void *userdata __UNUSED__)