xtlsoft/zephir-c-call

一个允许您在 Zephir 中调用 C 函数的扩展。

v0.1.0-stable 2019-07-25 06:08 UTC

This package is auto-updated.

Last update: 2024-09-25 18:20:26 UTC


README

一个允许您在 Zephir 中调用 C 函数的扩展。

安装

如果您的 zephir 安装在项目范围内

composer require xtlsoft/zephir-c-call

如果您的 zephir 安装在全局范围内

composer g require xtlsoft/zephir-c-call

如果您的 zephir 作为 zephir.phar 安装

您需要重新打包 zephir.phar 文件。

用法

您可以从 Zephir 调用 c_includec_callc_runf 函数。

c_include

c_include(string filename);

文件名必须是字面量。不要使用返回值。

c_call

c_call(
    string ret_type, string func_name,
    [string param1_type, string param1_value,
    [string param2_type, string param2_value,
    [string...
);

type 可以是 intlongdoublefloatstring 之一。

除了值之外,所有类型和 func_names 都应该是字面量。

c_runf

c_runf(
    string ret_type, string expr,
    [string arg1, [string arg2, [string arg3...
);

ret_type 和 expr 必须是字面量。

您可以使用 ${1}、${2}、${3}... 在 expr 中访问参数。

所有参数都是 zval* 类型。