16 printf(
"%d %d: %d\n", a1, a2, result);
22 static void test_func_gn(ffi_cif *cif
__UNUSED__,
void *rval,
void **avals,
27 a1 = *(
signed short *)avals[0];
28 a2 = *(
signed short *)avals[1];
34 typedef signed short (*
test_type)(
signed short,
signed short);
40 ffi_closure *pcl = ffi_closure_alloc(
sizeof(ffi_closure), &code);
42 ffi_type * cl_arg_types[3];
44 unsigned short a, b, res_closure;
53 cl_arg_types[0] = &ffi_type_sshort;
54 cl_arg_types[1] = &ffi_type_sshort;
55 cl_arg_types[2] =
NULL;
59 &ffi_type_sshort, cl_arg_types) == FFI_OK);
63 printf(
"res: %d\n", (
unsigned short)res_call);
68 res_closure = (*((
test_type)code))(2, 32765);
70 printf(
"res: %d\n", res_closure);