Commit f1c729c
committed
Add --enable-embed=static support on Windows
PHP's Unix build already documents and accepts --enable-embed=static
(see sapi/embed/config.m4) for building php<N>embed as a static library
with no DLL at runtime. The Windows config.w32 ignored the static
value, leaving php_embed.c compiled as a DLL consumer regardless.
When --enable-embed=static is passed on Windows:
* Inject /D PHP_EXPORTS /D LIBZEND_EXPORTS /D SAPI_EXPORTS
/D TSRM_EXPORTS into CFLAGS_EMBED so php_embed.c references PHP/
Zend/SAPI/TSRM symbols directly instead of through __declspec(
dllimport) thunks (which would produce LNK2019 with no DLL).
* Skip php_embed.c's ZEND_TSRMLS_CACHE_DEFINE() (gated on the new
PHP_EMBED_STATIC define). In static mode zend.c is in the same
link unit and already defines _tsrm_ls_cache; the duplicate from
php_embed.c produced LNK4006 / corrupt binary.
This patches only the source-side adjustments; producing a fat
static lib (linking PHP_GLOBAL_OBJS + STATIC_EXT_OBJS into
php<N>embed.lib) is a downstream Makefile concern.1 parent 7260b27 commit f1c729c
3 files changed
Lines changed: 18 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
5 | 12 | | |
6 | 13 | | |
7 | 14 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
9 | 19 | | |
10 | 20 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
| 33 | + | |
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| |||
0 commit comments