Foreign Function Interface目次
Main interface to C code and dataはじめにObjects 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. クラス概要
final
FFI
/* 定数 */
public
const
int
FFI::__BIGGEST_ALIGNMENT__;
/* メソッド */
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 )定義済み定数
C Data HandlesはじめにFFI\CData objects can be used in a number of ways as a regular PHP data:
クラス概要
final
FFI\CData
変更履歴
C Type Handlesはじめに
クラス概要
final
FFI\CType
/* 定数 */
public
const
int
FFI\CType::TYPE_VOID;
public
const
int
FFI\CType::TYPE_FLOAT;
public
const
int
FFI\CType::TYPE_DOUBLE;
public
const
int
FFI\CType::TYPE_LONGDOUBLE;
public
const
int
FFI\CType::TYPE_UINT8;
public
const
int
FFI\CType::TYPE_SINT8;
public
const
int
FFI\CType::TYPE_UINT16;
public
const
int
FFI\CType::TYPE_SINT16;
public
const
int
FFI\CType::TYPE_UINT32;
public
const
int
FFI\CType::TYPE_SINT32;
public
const
int
FFI\CType::TYPE_UINT64;
public
const
int
FFI\CType::TYPE_SINT64;
public
const
int
FFI\CType::TYPE_ENUM;
public
const
int
FFI\CType::TYPE_BOOL;
public
const
int
FFI\CType::TYPE_CHAR;
public
const
int
FFI\CType::TYPE_POINTER;
public
const
int
FFI\CType::TYPE_FUNC;
public
const
int
FFI\CType::TYPE_ARRAY;
public
const
int
FFI\CType::TYPE_STRUCT;
public
const
int
FFI\CType::ATTR_CONST;
public
const
int
FFI\CType::ATTR_INCOMPLETE_TAG;
public
const
int
FFI\CType::ATTR_VARIADIC;
public
const
int
FFI\CType::ATTR_INCOMPLETE_ARRAY;
public
const
int
FFI\CType::ATTR_VLA;
public
const
int
FFI\CType::ATTR_UNION;
public
const
int
FFI\CType::ATTR_PACKED;
public
const
int
FFI\CType::ATTR_MS_STRUCT;
public
const
int
FFI\CType::ATTR_GCC_STRUCT;
public
const
int
FFI\CType::ABI_DEFAULT;
public
const
int
FFI\CType::ABI_CDECL;
public
const
int
FFI\CType::ABI_FASTCALL;
public
const
int
FFI\CType::ABI_THISCALL;
public
const
int
FFI\CType::ABI_STDCALL;
public
const
int
FFI\CType::ABI_PASCAL;
public
const
int
FFI\CType::ABI_REGISTER;
public
const
int
FFI\CType::ABI_MS;
public
const
int
FFI\CType::ABI_SYSV;
public
const
int
FFI\CType::ABI_VECTORCALL;
/* メソッド */
public int getAlignment()
public FFI\CType getArrayElementType()
public int getArrayLength()
public int getAttributes()
public int getEnumKind()
public int getFuncABI()
public int getFuncParameterCount()
public FFI\CType getFuncParameterType(int
$index )public FFI\CType getFuncReturnType()
public int getKind()
public string getName()
public FFI\CType getPointerType()
public int getSize()
public array getStructFieldNames()
public int getStructFieldOffset(string
$name )public FFI\CType getStructFieldType(string
$name )定義済み定数
FFI Exceptionsはじめに
クラス概要
FFI\Exception
extends
Error
/* 継承したプロパティ */
protected
string
$message = "";
private
string
$string = "";
protected
int
$code;
protected
string
$file = "";
protected
int
$line;
private
array
$trace = [];
private
Throwablenull
$previous = null;
/* 継承したメソッド */
public __construct(string
$message = "", int $code = 0, Throwablenull $previous = null )final public string getMessage()
final public Throwablenull getPrevious()
final public int getCode()
final public string getFile()
final public int getLine()
final public array getTrace()
final public string getTraceAsString()
public string __toString()
private void __clone()
FFI Parser Exceptionsはじめに
クラス概要
final
FFI\ParserException
extends
FFI\Exception
/* 継承したプロパティ */
protected
string
$message = "";
private
string
$string = "";
protected
int
$code;
protected
string
$file = "";
protected
int
$line;
private
array
$trace = [];
private
Throwablenull
$previous = null;
/* 継承したメソッド */
public Error::__construct(string
$message = "", int $code = 0, Throwablenull $previous = null )final public string Error::getMessage()
final public Throwablenull Error::getPrevious()
final public int Error::getCode()
final public string Error::getFile()
final public int Error::getLine()
final public array Error::getTrace()
final public string Error::getTraceAsString()
public string Error::__toString()
private void Error::__clone()
|