27 printf(
"CALLED WITH %d %s {%f %f} {{%f %f} {%f %f}} %d\n",
28 o, s, p.
x, p.
y, r.
o.
x, r.
o.
y, r.
s.
h, r.
s.
w, last);
48 point_type.alignment = 0;
49 point_type.type = FFI_TYPE_STRUCT;
50 point_type.elements =
malloc(3 *
sizeof(ffi_type*));
51 point_type.elements[0] = &ffi_type_float;
52 point_type.elements[1] = &ffi_type_float;
53 point_type.elements[2] =
NULL;
56 size_type.alignment = 0;
57 size_type.type = FFI_TYPE_STRUCT;
58 size_type.elements =
malloc(3 *
sizeof(ffi_type*));
59 size_type.elements[0] = &ffi_type_float;
60 size_type.elements[1] = &ffi_type_float;
61 size_type.elements[2] =
NULL;
64 rect_type.alignment =0;
65 rect_type.type = FFI_TYPE_STRUCT;
66 rect_type.elements =
malloc(3 *
sizeof(ffi_type*));
67 rect_type.elements[0] = &point_type;
68 rect_type.elements[1] = &size_type;
69 rect_type.elements[2] =
NULL;
74 arglist[0] = &ffi_type_sint;
75 arglist[1] = &ffi_type_pointer;
76 arglist[2] = &point_type;
77 arglist[3] = &rect_type;
78 arglist[4] = &ffi_type_sint;
82 5, &ffi_type_sint, arglist);
91 Point p = { 1.0, 2.0 };
92 Rect r = { { 9.0, 10.0}, { -1.0, -2.0 } };
105 printf(
"CALLING WITH %d %s {%f %f} {{%f %f} {%f %f}} %d\n",
106 o, m, p.
x, p.
y, r.
o.
x, r.
o.
y, r.
s.
h, r.
s.
w, l);
110 printf (
"The result is %d\n", (
int)result);
int doit(int o, char *s, Point p, Rect r, int last)
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)