[php-src] PR #22166: Add --enable-embed=static support on Windows

From: Date: Thu, 28 May 2026 06:12:01 +0000
Subject: [php-src] PR #22166: Add --enable-embed=static support on Windows
Groups: php.git-pulls 
Request: Send a blank email to git-pulls+get-36247@lists.php.net to get a copy of this message
Pull Request: https://github.com/php/php-src/pull/22166 Author: luthermonson ## Summary Unix already supports --enable-embed=static (see sapi/embed/config.m4); the Windows config.w32 ignored the static value and php_embed.c got compiled as a DLL consumer regardless. Result: linking embed without php<N>.dll fails with LNK2019 on every PHP/Zend symbol referenced from php_embed.c, and (under ZTS) LNK4006 on _tsrm_ls_cache due to a duplicate definition between zend.c and php_embed.c. When --enable-embed=static is passed on Windows: * CFLAGS_EMBED gets /D PHP_EXPORTS /D LIBZEND_EXPORTS /D SAPI_EXPORTS /D TSRM_EXPORTS so php_embed.c references core symbols directly instead of through __declspec(dllimport) thunks. * php_embed.c's ZEND_TSRMLS_CACHE_DEFINE() is skipped (gated on new PHP_EMBED_STATIC); zend.c provides the canonical definition. This patches only the source-side adjustments. Producing a fat static lib (composition of php<N>embed.lib) is a separate Makefile concern handled by downstream build tools.

« previous php.git-pulls (#36247) next »