From af758ef13033e35212f1c766b8a29408f9c28f4a Mon Sep 17 00:00:00 2001 From: tianfenghan Date: Sat, 23 May 2026 14:15:23 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E6=8C=89=E7=9B=AE=E6=A0=87?= =?UTF-8?q?=E5=90=8D=E7=A7=B0=E5=8C=BA=E5=88=86=E5=87=BD=E6=95=B0=E4=B8=8E?= =?UTF-8?q?=E5=85=A8=E5=B1=80=E5=8F=98=E9=87=8F=E5=A3=B0=E6=98=8E=E5=A4=B4?= =?UTF-8?q?=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Php/CompilerBase.php | 2 -- src/Php/Translator.php | 9 ++++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Php/CompilerBase.php b/src/Php/CompilerBase.php index 05726f23..39087cfe 100644 --- a/src/Php/CompilerBase.php +++ b/src/Php/CompilerBase.php @@ -155,8 +155,6 @@ class CompilerBase extends \PhpAot\Core\Translator 'phpx.h', 'phpx_helper.h', 'phpx_func.h', - 'php_func_decl.h', - 'php_global_var_decl.h', 'php_aot_helper.h', ]; protected array $localHeaders = []; diff --git a/src/Php/Translator.php b/src/Php/Translator.php index a569bbd2..12ed97a5 100644 --- a/src/Php/Translator.php +++ b/src/Php/Translator.php @@ -779,8 +779,8 @@ CODE; $job = $this->maxJob; // 生成所有函数声明、全局变量声明的头文件 - $this->genFunctionDeclaration($this->getIncludeDir() . '/php_func_decl.h'); - $this->genExternGlobalVars($this->getIncludeDir() . '/php_global_var_decl.h'); + $this->genFunctionDeclaration($this->getIncludeDir() . "/php_{$this->targetName}_func_decl.h"); + $this->genExternGlobalVars($this->getIncludeDir() . "/php_{$this->targetName}_global_var_decl.h"); // 生成扩展模块的源文件 $sourceFiles[] = $this->genExtension(); @@ -1133,7 +1133,10 @@ CODE; public function genIncludeHeaderFiles(): string { - $headers = array_merge($this->globalHeaders, $this->localHeaders); + $headers = array_merge($this->globalHeaders, [ + "php_{$this->targetName}_func_decl.h", + "php_{$this->targetName}_global_var_decl.h", + ], $this->localHeaders); $lines = []; foreach ($headers as $header) { $lines[] = '#include <' . $header . '>';