---
name: "ffi_prep_cif_var"
section: "3"
platform: "linux"
package: "libffi"
version: "3.8.0-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux", "macos"]
url: "https://new.carta.tech/ffi_prep_cif_var"
---

# ffi\_prep\_cif\_var(3)

Prepare a ffi\_cif structure for use with ffi\_call for variadic functions.

## NAME

**ffi\_prep\_cif\_var** – Prepare a **ffi\_cif** structure for use with **ffi\_call** for variadic functions.

## SYNOPSIS

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

*ffi\_status*\

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

## DESCRIPTION

The **ffi\_prep\_cif\_var** function prepares a **ffi\_cif** structure for use with **ffi\_call** for variadic functions. *abi* specifies a set of calling conventions to use. *atypes* is an array of *ntotalargs* 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. *nfixedargs* must contain the number of fixed (non-variadic) arguments. Note that to call a non-variadic function **ffi\_prep\_cif** must be used.

## RETURN VALUES

Upon successful completion, **ffi\_prep\_cif\_var** 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(3)](/ffi_prep_cif/3.md)
