2
Purpose: Check structures.
5
Originator: From the original ffitest.c */
15
static test_structure_5 struct5(test_structure_5 ts1, test_structure_5 ts2)
26
ffi_type *args[MAX_ARGS];
27
void *values[MAX_ARGS];
29
ffi_type *ts5_type_elements[3];
31
test_structure_5 ts5_arg1, ts5_arg2;
33
/* This is a hack to get a properly aligned result buffer */
34
test_structure_5 *ts5_result =
35
(test_structure_5 *) malloc (sizeof(test_structure_5));
38
ts5_type.alignment = 0;
39
ts5_type.type = FFI_TYPE_STRUCT;
40
ts5_type.elements = ts5_type_elements;
41
ts5_type_elements[0] = &ffi_type_schar;
42
ts5_type_elements[1] = &ffi_type_schar;
43
ts5_type_elements[2] = NULL;
47
values[0] = &ts5_arg1;
48
values[1] = &ts5_arg2;
50
/* Initialize the cif */
51
CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &ts5_type, args) == FFI_OK);
58
ffi_call (&cif, FFI_FN(struct5), ts5_result, values);
60
CHECK(ts5_result->c1 == 7);
61
CHECK(ts5_result->c2 == 3);