Skip to contents

Lists what ffi_cdef() declared in a library handle, with whether zuffi can call each one and, if not, why (D12): a type it cannot pass, a symbol the library does not export, a body it skipped. ffi_constants() lists the constants.

Usage

ffi_functions(lib)

Arguments

lib

A handle from ffi_dlopen().

Value

A data frame with one row per function, in the order declared: name, signature (the declaration as C), callable (logical) and reason (NA when callable).

Examples

lib <- ffi_dlopen(if (.Platform$OS.type == "windows") "ucrtbase" else "m")
ffi_cdef(lib, "double cos(double); int with_body(int x) { return x; }")
ffi_functions(lib)
#>        name            signature callable
#> 1       cos   double cos(double)     TRUE
#> 2 with_body int with_body(int x)    FALSE
#>                                                                                                                                     reason
#> 1                                                                                                                                     <NA>
#> 2 `with_body` cannot be called: its body was skipped: ffi_cdef() calls only what the library exports, and does not compile function bodies
ffi_close(lib)