2
Purpose: Check structures.
5
Originator: From the original ffitest.c */
15
static test_structure_3 struct3(test_structure_3 ts)
25
ffi_type *args[MAX_ARGS];
26
void *values[MAX_ARGS];
29
ffi_type *ts3_type_elements[2];
31
ts3_type.alignment = 0;
32
ts3_type.type = FFI_TYPE_STRUCT;
33
ts3_type.elements = ts3_type_elements;
34
ts3_type_elements[0] = &ffi_type_sint;
35
ts3_type_elements[1] = NULL;
37
test_structure_3 ts3_arg;
38
test_structure_3 *ts3_result =
39
(test_structure_3 *) malloc (sizeof(test_structure_3));
44
/* Initialize the cif */
45
CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1,
46
&ts3_type, args) == FFI_OK);
49
compare_value = ts3_arg.si;
51
ffi_call(&cif, FFI_FN(struct3), ts3_result, values);
53
printf ("%d %d\n", ts3_result->si, -(compare_value*2));
55
CHECK(ts3_result->si == -(compare_value*2));