2
Purpose: Check structures.
5
Originator: From the original ffitest.c */
15
static test_structure_6 struct6 (test_structure_6 ts)
26
ffi_type *args[MAX_ARGS];
27
void *values[MAX_ARGS];
29
ffi_type *ts6_type_elements[3];
31
ts6_type.alignment = 0;
32
ts6_type.type = FFI_TYPE_STRUCT;
33
ts6_type.elements = ts6_type_elements;
34
ts6_type_elements[0] = &ffi_type_float;
35
ts6_type_elements[1] = &ffi_type_double;
36
ts6_type_elements[2] = NULL;
39
test_structure_6 ts6_arg;
41
/* This is a hack to get a properly aligned result buffer */
42
test_structure_6 *ts6_result =
43
(test_structure_6 *) malloc (sizeof(test_structure_6));
48
/* Initialize the cif */
49
CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ts6_type, args) == FFI_OK);
54
printf ("%g\n", ts6_arg.f);
55
printf ("%g\n", ts6_arg.d);
57
ffi_call(&cif, FFI_FN(struct6), ts6_result, values);
59
CHECK(ts6_result->f == 5.55f + 1);
60
CHECK(ts6_result->d == 6.66 + 1);