TypePHP 编译器
https://swoole.com/aot/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
519 B
31 lines
519 B
--TEST--
|
|
FFI addr cast typeof and sizeof
|
|
--EXTENSIONS--
|
|
ffi
|
|
--ENV--
|
|
USE_ZEND_ALLOC=0
|
|
--INI--
|
|
ffi.enable=1
|
|
--FILE--
|
|
<?php
|
|
|
|
function main(): void
|
|
{
|
|
$value = FFI::new("int");
|
|
$value->cdata = 123;
|
|
|
|
$addr = FFI::addr($value);
|
|
$ptr = FFI::cast("int*", $addr);
|
|
$type = FFI::typeof($value);
|
|
|
|
var_dump($addr instanceof FFI\CData);
|
|
var_dump($ptr instanceof FFI\CData);
|
|
var_dump($type instanceof FFI\CType);
|
|
var_dump(FFI::sizeof($type));
|
|
}
|
|
?>
|
|
--EXPECT--
|
|
bool(true)
|
|
bool(true)
|
|
bool(true)
|
|
int(4)
|
|
|