(ffi--dlopen STR)
. A simple wrapper for dlopen
(actually
lt_dlopen
). This returns the library handle, a C pointer.
(ffi--dlsym STR HANDLE)
. A simple wrapper for dlsym
(actually
lt_dlsym
). This finds the C symbol named STR in a library. HANDLE is a
library handle, as returned by a function defined by define-ffi-library
.
This returns a C pointer to the indicated symbol, or nil
if it can’t be
found. These pointers need not be freed.
(ffi--prep-cif RETURN-TYPE ARG-TYPES &optional N-FIXED-ARGS)
. A simple
wrapper for ‘libffi’’s ffi_prep_cif
and ffi_prep_cif_var
. RETURN-TYPE is
the return type; ARG-TYPES is a vector of argument types. If given,
N-FIXED-ARGS is an integer holding the number of fixed args. Its presence,
even if 0, means that a varargs call is being made. This function returns a C
pointer wrapped in a Lisp object; the garbage collector will handle any needed
finalization.
(ffi--call CIF FUNCTION &rest ARG...)
. Make an FFI call.
CIF is the return from ffi--prep-cif
.
FUNCTION is a C pointer to the function to call, normally from ffi--dlsym
.
ARGS are the arguments to pass to FUNCTION.
(ffi--mem-ref POINTER TYPE)
. Read memory from POINTER and convert it, using
the usual conversions, as the given type. This is the Lisp equivalent of
*pointer
in C.
(ffi--mem-set POINTER TYPE VALUE)
. Copy the Lisp value to the memory pointed
at by the pointer, using the type to guide the conversion. This is the Lisp
equivalent of *pointer = value
in C.
(ffi--type-size TYPE)
. Return the size of TYPE.
(ffi--type-alignment TYPE)
. Return the alignment needed by TYPE.
(ffi--define-struct &rest TYPE...)
. Define a new foreign structure type,
whose fields are the indicated types.
(ffi--define-union &rest TYPE...)
. Define a new foreign union type, whose
fields are the indicated types.