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_ raw Deprecated - ffi_
java_ ⚠raw_ call Deprecated - ffi_
java_ ⚠raw_ size Deprecated - ffi_
java_ ⚠raw_ to_ ptrarray Deprecated - ffi_
prep_ ⚠cif - ffi_
prep_ ⚠cif_ var - ffi_
prep_ ⚠closure Deprecated - ffi_
prep_ ⚠closure_ loc - ffi_
prep_ ⚠go_ closure - ffi_
prep_ ⚠java_ raw_ closure Deprecated - ffi_
prep_ ⚠java_ raw_ closure_ loc Deprecated - 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