Skip to contents

C does not say what type an argument given through ... has, and libffi must know it: on Apple arm64 such arguments are even passed differently from named ones. So each one is typed at the call, lib$printf("%ld\n", ffi_arg(3, "long")), and an argument given without ffi_arg() is an error rather than a guess (design §4.1).

Usage

ffi_arg(value, type)

Arguments

value

The value, converted at the call by the rules of type (design §6).

type

A C type name, such as "long", "double" or "const char *".

Value

An object of class zuffi_arg.

Details

C promotes float to double, and bool, char, short and the 8- and 16-bit integer types to int, in a variadic call, so those types are refused here: give the promoted type.

Examples

ffi_arg(3, "long")
#> <zuffi_arg long>
#> [1] 3
ffi_arg("text", "const char *")
#> <zuffi_arg const char *>
#> [1] "text"