FFI::cast

Performs a C type cast

説明

public FFI\CDatanull FFI::cast(FFI\CTypestring $type, FFI\CDataintfloatboolnull &$ptr)

FFI::cast creates a new FFI\CData object, that references the same C data structure, but is associated with a different type. The resulting object does not own the C data, and the source ptr must survive the result. The C type may be specified as a string with any valid C type declaration or as FFI\CType object, created before. Any type declared for the instance is allowed.

パラメータ

type

A valid C declaration as string, or an instance of FFI\CType which has already been created.

ptr

The handle of the pointer to a C data structure.

戻り値

Returns the freshly created FFI\CData object.

変更履歴

バージョン 説明
8.3.0 Calling FFI::cast statically is now deprecated.