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