Доступ к типам C

(PHP 7 >= 7.4.0, PHP 8)

Введение

Обзор классов

final class FFI\CType {
/* Константы */
public const int TYPE_VOID;
public const int TYPE_FLOAT;
public const int TYPE_DOUBLE;
public const int TYPE_LONGDOUBLE;
public const int TYPE_UINT8;
public const int TYPE_SINT8;
public const int TYPE_UINT16;
public const int TYPE_SINT16;
public const int TYPE_UINT32;
public const int TYPE_SINT32;
public const int TYPE_UINT64;
public const int TYPE_SINT64;
public const int TYPE_ENUM;
public const int TYPE_BOOL;
public const int TYPE_CHAR;
public const int TYPE_POINTER;
public const int TYPE_FUNC;
public const int TYPE_ARRAY;
public const int TYPE_STRUCT;
public const int ATTR_CONST;
public const int ATTR_INCOMPLETE_TAG;
public const int ATTR_VARIADIC;
public const int ATTR_INCOMPLETE_ARRAY;
public const int ATTR_VLA;
public const int ATTR_UNION;
public const int ATTR_PACKED;
public const int ATTR_MS_STRUCT;
public const int ATTR_GCC_STRUCT;
public const int ABI_DEFAULT;
public const int ABI_CDECL;
public const int ABI_FASTCALL;
public const int ABI_THISCALL;
public const int ABI_STDCALL;
public const int ABI_PASCAL;
public const int ABI_REGISTER;
public const int ABI_MS;
public const int ABI_SYSV;
public const int ABI_VECTORCALL;
/* Методы */
public getAlignment(): int
public getArrayLength(): int
public getAttributes(): int
public getEnumKind(): int
public getFuncABI(): int
public getFuncParameterCount(): int
public getFuncParameterType(int $index): FFI\CType
public getKind(): int
public getName(): string
public getSize(): int
public getStructFieldNames(): array
public getStructFieldOffset(string $name): int
public getStructFieldType(string $name): FFI\CType
}

Предопределённые константы

FFI\CType::TYPE_VOID

FFI\CType::TYPE_FLOAT

FFI\CType::TYPE_DOUBLE

FFI\CType::TYPE_LONGDOUBLE

FFI\CType::TYPE_UINT8

FFI\CType::TYPE_SINT8

FFI\CType::TYPE_UINT16

FFI\CType::TYPE_SINT16

FFI\CType::TYPE_UINT32

FFI\CType::TYPE_SINT32

FFI\CType::TYPE_UINT64

FFI\CType::TYPE_SINT64

FFI\CType::TYPE_ENUM

FFI\CType::TYPE_BOOL

FFI\CType::TYPE_CHAR

FFI\CType::TYPE_POINTER

FFI\CType::TYPE_FUNC

FFI\CType::TYPE_ARRAY

FFI\CType::TYPE_STRUCT

FFI\CType::ATTR_CONST

FFI\CType::ATTR_INCOMPLETE_TAG

FFI\CType::ATTR_VARIADIC

FFI\CType::ATTR_INCOMPLETE_ARRAY

FFI\CType::ATTR_VLA

FFI\CType::ATTR_UNION

FFI\CType::ATTR_PACKED

FFI\CType::ATTR_MS_STRUCT

FFI\CType::ATTR_GCC_STRUCT

FFI\CType::ABI_DEFAULT

FFI\CType::ABI_CDECL

FFI\CType::ABI_FASTCALL

FFI\CType::ABI_THISCALL

FFI\CType::ABI_STDCALL

FFI\CType::ABI_PASCAL

FFI\CType::ABI_REGISTER

FFI\CType::ABI_MS

FFI\CType::ABI_SYSV

FFI\CType::ABI_VECTORCALL

Содержание

add a note

User Contributed Notes 1 note

up
-1
scorninpc at php dot net
3 years ago
You can compare CTypes if you want to know if the type are correct

\FFI::typeof(\FFI::addr($a)) == \FFI::typeof(\FFI::new("void *"))

CType need some methods, like equal() or toString(), but .....
To Top