| 1 |
.Dd January 25, 2011 |
| 2 |
.Dt ffi_prep_cif_var 3 |
| 3 |
.Sh NAME |
| 4 |
.Nm ffi_prep_cif_var |
| 5 |
.Nd Prepare a |
| 6 |
.Nm ffi_cif |
| 7 |
structure for use with |
| 8 |
.Nm ffi_call |
| 9 |
for variadic functions. |
| 10 |
.Sh SYNOPSIS |
| 11 |
.In ffi.h |
| 12 |
.Ft ffi_status |
| 13 |
.Fo ffi_prep_cif_var |
| 14 |
.Fa "ffi_cif *cif" |
| 15 |
.Fa "ffi_abi abi" |
| 16 |
.Fa "unsigned int nfixedargs" |
| 17 |
.Fa "unsigned int ntotalargs" |
| 18 |
.Fa "ffi_type *rtype" |
| 19 |
.Fa "ffi_type **atypes" |
| 20 |
.Fc |
| 21 |
.Sh DESCRIPTION |
| 22 |
The |
| 23 |
.Nm ffi_prep_cif_var |
| 24 |
function prepares a |
| 25 |
.Nm ffi_cif |
| 26 |
structure for use with |
| 27 |
.Nm ffi_call |
| 28 |
for variadic functions. |
| 29 |
.Fa abi |
| 30 |
specifies a set of calling conventions to use. |
| 31 |
.Fa atypes |
| 32 |
is an array of |
| 33 |
.Fa ntotalargs |
| 34 |
pointers to |
| 35 |
.Nm ffi_type |
| 36 |
structs that describe the data type, size and alignment of each argument. |
| 37 |
.Fa rtype |
| 38 |
points to an |
| 39 |
.Nm ffi_type |
| 40 |
that describes the data type, size and alignment of the |
| 41 |
return value. |
| 42 |
.Fa nfixedargs |
| 43 |
must contain the number of fixed (non-variadic) arguments. |
| 44 |
Note that to call a non-variadic function |
| 45 |
.Nm ffi_prep_cif |
| 46 |
must be used. |
| 47 |
.Sh RETURN VALUES |
| 48 |
Upon successful completion, |
| 49 |
.Nm ffi_prep_cif_var |
| 50 |
returns |
| 51 |
.Nm FFI_OK . |
| 52 |
It will return |
| 53 |
.Nm FFI_BAD_TYPEDEF |
| 54 |
if |
| 55 |
.Fa cif |
| 56 |
is |
| 57 |
.Nm NULL |
| 58 |
or |
| 59 |
.Fa atypes |
| 60 |
or |
| 61 |
.Fa rtype |
| 62 |
is malformed. If |
| 63 |
.Fa abi |
| 64 |
does not refer to a valid ABI, |
| 65 |
.Nm FFI_BAD_ABI |
| 66 |
will be returned. Available ABIs are |
| 67 |
defined in |
| 68 |
.Nm <ffitarget.h> |
| 69 |
. |
| 70 |
.Sh SEE ALSO |
| 71 |
.Xr ffi 3 , |
| 72 |
.Xr ffi_call 3 , |
| 73 |
.Xr ffi_prep_cif 3 |