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
7structure for use with
8.Nm ffi_call
9for 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
22The
23.Nm ffi_prep_cif_var
24function prepares a
25.Nm ffi_cif
26structure for use with
27.Nm ffi_call
28for variadic functions.
29.Fa abi
30specifies a set of calling conventions to use.
31.Fa atypes
32is an array of
33.Fa ntotalargs
34pointers to
35.Nm ffi_type
36structs that describe the data type, size and alignment of each argument.
37.Fa rtype
38points to an
39.Nm ffi_type
40that describes the data type, size and alignment of the
41return value.
42.Fa nfixedargs
43must contain the number of fixed (non-variadic) arguments.
44Note that to call a non-variadic function
45.Nm ffi_prep_cif
46must be used.
47.Sh RETURN VALUES
48Upon successful completion,
49.Nm ffi_prep_cif_var
50returns
51.Nm FFI_OK .
52It will return
53.Nm FFI_BAD_TYPEDEF
54if
55.Fa cif
56is
57.Nm NULL
58or
59.Fa atypes
60or
61.Fa rtype
62is malformed. If
63.Fa abi
64does not refer to a valid ABI,
65.Nm FFI_BAD_ABI
66will be returned. Available ABIs are
67defined 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
74