Re: Using arginfo generating stubs in PECL extensions
| From: | Christoph M. Becker | Date: | Fri, 11 Dec 2020 18:02:51 +0000 |
| Subject: | Re: Using arginfo generating stubs in PECL extensions | ||
| References: | 1 | Groups: | php.pecl.dev |
| Request: | Send a blank email to pecl-dev+get-17105@lists.php.net to get a copy of this message | ||
On 11.12.2020 at 16:39, Calvin Buckley wrote:
> Might be better in php-internals (haven't subbed yet), but:
>
> I noticed one of the new facilities in PHP 8 was generating arginfo
> from a PHP stub. This is pretty useful for reasons elaborated
> elsewhere, but I'm wondering how this should be used for PECL
> extensions. I noticed what PHP itself does is keep the generated
> arginfo header. My questions are:
>
> 1. Should this be used at all PECL extensions yet? That is, is this
> some PHP facility that isn't ready for external usage yet?
It's fine to use it right away.
> 2. I noticed the build system deletes the stub after it's built the
> object files. Since I might want to keep the header (for PHP 7.x
> users), this is a bit annoying, especially as PHP itself keeps them.
I don't think that this is supposed to happen. Is there some extension
specific clean-up involved?
> 3. Are the headers that get generated have any guarantees on usability
> in PHP 7.x?
They are not usable on PHP 7 due to some missing macros. It is possible
to use define the macros for older PHP versions, but you may be better
off (at least for BC reasons) to add @generate-legacy-arginfo to the
stub file; this should generate a _legacy_arginfo.h file for inclusion
when building for PHP 7.
> 4. Part of #2, because it deletes the headers, it makes rebuilding if
> you generate a change in source *very* annoying, because the header
> won't be found.
See above (question 2).
> 5. Actually downloading PHP-Parser during build is really unexpected. I
> assume if I have it on my include path it won't do that, but for
> isolated builds it could be really confusing. I assume if I ship
> arginfo header in a release tarball, it won't do that?
Indeed. If _arginfo.h is available and up to date (there is a SHA1 hash
in the file), rebuilding should not happen.
Christoph