---
name: "ffi_prep_cif"
section: "3"
platform: "macos"
package: "libffi"
version: "40"
release: "macOS 26.5"
platforms: ["linux", "macos"]
url: "https://new.carta.tech/ffi_prep_cif"
---

# ffi\_prep\_cif(3)

Prepare a ffi\_cif structure for use with ffi\_call

## NAME

**ffi\_prep\_cif** – Prepare a **ffi\_cif** structure for use with **ffi\_call**

## SYNOPSIS

**#include \<ffi.h\>**

*ffi\_status*\

**ffi\_prep\_cif**(*ffi\_cif \*cif*, *ffi\_abi abi*, *unsigned int nargs*, *ffi\_type \*rtype*, *ffi\_type \*\*atypes*);

## DESCRIPTION

The **ffi\_prep\_cif** function prepares a **ffi\_cif** structure for use with  **ffi\_call** *abi* specifies a set of calling conventions to use. *atypes* is an array of *nargs* pointers to **ffi\_type** structs that describe the data type, size and alignment of each argument. *rtype* points to an **ffi\_type** that describes the data type, size and alignment of the return value. Note that to call a variadic function **ffi\_prep\_cif\_var** must be used instead.

## RETURN VALUES

Upon successful completion, **ffi\_prep\_cif** returns **FFI\_OK**. It will return **FFI\_BAD\_TYPEDEF** if *cif* is **NULL** or *atypes* or *rtype* is malformed. If *abi* does not refer to a valid ABI, **FFI\_BAD\_ABI** will be returned. Available ABIs are defined in **\<ffitarget.h\>**.

## SEE ALSO

[ffi(3)](/ffi/3.md), [ffi\_call(3)](/ffi_call/3.md), [ffi\_prep\_cif\_var(3)](/ffi_prep_cif_var/3.md)
