15 void** args,
void* userdata __UNUSED__)
17 char* format = *(
char**)args[0];
18 double doubleValue = *(
double*)args[1];
20 *(
ffi_arg*)resp = printf(format, doubleValue);
27 ffi_closure *pcl = ffi_closure_alloc(
sizeof(ffi_closure), &code);
29 ffi_type* arg_types[3];
31 char* format =
"%.1f\n";
35 arg_types[0] = &ffi_type_pointer;
36 arg_types[1] = &ffi_type_double;
41 arg_types) == FFI_OK);
47 ffi_call(&cif, FFI_FN(printf), &res, args);
49 printf(
"res: %d\n", (
int) res);
55 res = ((int(*)(
char*, ...))(code))(format, doubleArg);
57 printf(
"res: %d\n", (
int) res);
ffi_status ffi_prep_cif_var(ffi_cif *cif, ffi_abi abi, unsigned int nfixedargs, unsigned int ntotalargs, ffi_type *rtype, ffi_type **atypes)
static void cls_double_va_fn(ffi_cif *cif __UNUSED__, void *resp, void **args, void *userdata __UNUSED__)
ffi_status ffi_prep_closure_loc(ffi_closure *closure, ffi_cif *cif, void(*fun)(ffi_cif *, void *, void **, void *), void *user_data, void *codeloc)
void ffi_call(ffi_cif *cif, void(*fn)(void), void *rvalue, void **avalue)