Main interface to C code and dataIntroductionObjects of this class are created by the factory methods FFI::cdef, FFI::load or FFI::scope. Defined C variables are made available as properties of the FFI instance, and defined C functions are made available as methods of the FFI instance. Declared C types can be used to create new C data structures using FFI::new and FFI::type.
FFI definition parsing and shared library loading may take significant time. It is not useful
to do it on each HTTP request in a Web environment. However, it is possible to preload FFI definitions
and libraries at PHP startup, and to instantiate FFI objects when necessary. Header files
may be extended with special It is possible to preload more than one C header file into the same scope. Class synopsis
final
FFI
/* Constants */
public
const
int
FFI::__BIGGEST_ALIGNMENT__;
/* Methods */
public static FFI\CData addr(FFI\CData
&$ptr )public static int alignof(FFI\CDataFFI\CType
&$ptr )public static FFI\CType arrayType(FFI\CType
$type , array $dimensions )public FFI\CDatanull cast(FFI\CTypestring
$type , FFI\CDataintfloatboolnull &$ptr )public static FFI cdef(string
$code = "", stringnull $lib = null )public static void free(FFI\CData
&$ptr )public static bool isNull(FFI\CData
&$ptr )public static FFInull load(string
$filename )public static int memcmp(stringFFI\CData
&$ptr1 , stringFFI\CData &$ptr2 , int $size )public static void memcpy(FFI\CData
&$to , FFI\CDatastring &$from , int $size )public static void memset(FFI\CData
&$ptr , int $value , int $size )public FFI\CDatanull new(FFI\CTypestring
$type , bool $owned = true , bool $persistent = false )public static FFI scope(string
$name )public static int sizeof(FFI\CDataFFI\CType
&$ptr )public static string string(FFI\CData
&$ptr , intnull $size = null )public FFI\CTypenull type(string
$type )public static FFI\CType typeof(FFI\CData
&$ptr )Predefined Constants
|