How to call 'printf' using libffi?

Andrew Haley aph@redhat.com
Fri Mar 19 10:13:34 GMT 2021


On 3/18/21 3:25 PM, Anthony Green wrote:
>   arg_types[0] = &ffi_type_pointer;
>   arg_types[1] = &ffi_type_double;
>   arg_types[2] = &ffi_type_sint;
>   arg_types[3] = NULL;
> 
>   /* This printf call is variadic */
>   ffi_prep_cif_var(&cif, FFI_DEFAULT_ABI, 1, 3, &ffi_type_sint, arg_types);

Surely that only works if a varargs call uses the same ABI as a normal
call. They don't always,

-- 
Andrew Haley  (he/him)
Java Platform Lead Engineer
Red Hat UK Ltd. <https://www.redhat.com>
https://keybase.io/andrewhaley
EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671



More information about the Libffi-discuss mailing list