[php-src] PR #15592: Fix ZEND_EXT_API wrt accessibility of OPcache symbols on Windows
| From: | cmb69 | Date: | Mon, 26 Aug 2024 18:42:32 +0000 |
| Subject: | [php-src] PR #15592: Fix ZEND_EXT_API wrt accessibility of OPcache symbols on Windows | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-28207@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/15592
Author: cmb69
When building a DLL which exports symbols these need to be explicitly exported like on other
platforms. When building a DLL which accesses these symbols, they should be imported for
performance reasons if the symbols are referring to functions, and *have* *to* be imported if the
symbols are referring to data.[1]
So we do the common dllexport/dllimport "dance" depending on a macro which is only set
when building OPcache.
[1] <https://learn.microsoft.com/en-us/cpp/build/importing-into-an-application-using-declspec-dllimport?view=msvc-170>
---
This should solve @dstogov's concerns from PR #15543, and makes it possible to statically link
to
smm_shared_globals in the import library of php_opcache.dll.
cc @bwoebi, @realFlowControl, maybe you want to test this.
One problem remains, though, namely that apparently none of the OPcache headers are exported (aka.
installed), so phpize builds can't use these (easily). Is there any particular reason for that?
Also note that almost all extensions doesn't handle the export/import on Windows properly; even
if only function symbols are exported, accessing them without dllimport has a small performance
impact. Maybe we should improve that over time.