Function libffi::low::prep_cif_var

source ·
pub unsafe fn prep_cif_var(
    cif: *mut ffi_cif,
    abi: ffi_abi,
    nfixedargs: usize,
    ntotalargs: usize,
    rtype: *mut ffi_type,
    atypes: *mut *mut ffi_type
) -> Result<()>
Expand description

Initalizes a CIF (Call Interface) for a varargs function.

We need to initialize a CIF before we can use it to call a function or create a closure. This function lets us specify the calling convention to use and the argument and result types. For non-varargs CIF initialization, see prep_cif.

Safety

The CIF cif retains references to rtype and atypes, so if they are no longer live when the CIF is used then the behavior is undefined.

Arguments

  • cif — the CIF to initialize
  • abi — the calling convention to use
  • nfixedargs — the number of fixed arguments
  • ntotalargs — the total number of arguments, including fixed and var args
  • rtype — the result type
  • atypes — the argument types (length must be at least nargs)

Result

Ok(()) for success or Err(e) for failure.