Crate libffi_sys

Source
Expand description

Low-level Rust bindings for libffi

The C libffi library provides two main facilities: assembling calls to functions dynamically, and creating closures that can be called as ordinary C functions.

This is a mostly undocumented wrapper, originally generated by bindgen then cleaned up manually, intended as the basis for higher-level bindings.

See the libffi crate for a higher-level API.

§Usage

libffi-sys can either build its own copy of the libffi C library from github or it can link against your system’s C libffi. By default it builds its own because many systems ship with an old C libffi; this requires that you have a working make, C compiler, automake, and autoconf first. If your system libffi is recent enough (v3.2.1 as of October 2019), you can instead enable the system feature flag to use that.

On Windows, it is not supported to link against a shared libffi library as it is generally not available. Automake and autoconf are not required when building for the x86_64-pc-windows-msvc and i686-pc-windows-msvc targets.

If you want this crate to build a C libffi for you, add

[dependencies]
libffi-sys = "3.3.1"

to your Cargo.toml. If you want to use your system C libffi, then

[dependencies.libffi-sys]
version = "3.3.1"
features = ["system"]

to your Cargo.toml instead.

This crate supports Rust version 1.78 and later.

Structs§

ffi_cif
A struct used by libffi to describe a function’s ABI and type signature.
ffi_closure
A struct used by libffi to describe and manage closures.
ffi_go_closure
ffi_java_raw_closure
ffi_raw_closure
ffi_type
A struct used by libffi to describe types and their memory layout.

Constants§

FFI_64_BIT_MAX
FFI_CLOSURES
FFI_NATIVE_RAW_API
FFI_SIZEOF_ARG
FFI_SIZEOF_JAVA_RAW
FFI_TRAMPOLINE_SIZE
FFI_TYPE_COMPLEX
FFI_TYPE_DOUBLE
FFI_TYPE_FLOAT
FFI_TYPE_INT
FFI_TYPE_LAST
FFI_TYPE_LONGDOUBLE
FFI_TYPE_POINTER
FFI_TYPE_SINT8
FFI_TYPE_SINT16
FFI_TYPE_SINT32
FFI_TYPE_SINT64
FFI_TYPE_STRUCT
FFI_TYPE_UINT8
FFI_TYPE_UINT16
FFI_TYPE_UINT32
FFI_TYPE_UINT64
FFI_TYPE_VOID
ffi_abi_FFI_DEFAULT_ABI
ffi_abi_FFI_EFI64
ffi_abi_FFI_FIRST_ABI
ffi_abi_FFI_GNUW64
ffi_abi_FFI_LAST_ABI
ffi_abi_FFI_UNIX64
ffi_abi_FFI_WIN64
ffi_status_FFI_BAD_ABI
ffi_status_FFI_BAD_ARGTYPE
ffi_status_FFI_BAD_TYPEDEF
ffi_status_FFI_OK
ffi_type_enum_COMPLEX
ffi_type_enum_STRUCT

Statics§

ffi_type_double
ffi_type_float
ffi_type_longdouble
ffi_type_pointer
ffi_type_sint8
ffi_type_sint16
ffi_type_sint32
ffi_type_sint64
ffi_type_uint8
ffi_type_uint16
ffi_type_uint32
ffi_type_uint64
ffi_type_void

Functions§

ffi_call
ffi_call_go
ffi_closure_alloc
ffi_closure_free
ffi_get_struct_offsets
ffi_java_ptrarray_to_rawDeprecated
ffi_java_raw_callDeprecated
ffi_java_raw_sizeDeprecated
ffi_java_raw_to_ptrarrayDeprecated
ffi_prep_cif
ffi_prep_cif_var
ffi_prep_closureDeprecated
ffi_prep_closure_loc
ffi_prep_go_closure
ffi_prep_java_raw_closureDeprecated
ffi_prep_java_raw_closure_locDeprecated
ffi_prep_raw_closure
ffi_prep_raw_closure_loc
ffi_ptrarray_to_raw
ffi_raw_call
ffi_raw_size
ffi_raw_to_ptrarray

Type Aliases§

ffi_abi
The type used to convey the ABI of a function.
ffi_arg
The smallest unsigned integer type returned by ffi_call.
ffi_java_raw
ffi_sarg
The smallest signed integer type returned by ffi_call.
ffi_status
The return type of libffi’s functions that may return an error.
ffi_type_enum

Unions§

ffi_raw
ffi_trampoline