Re: streams, stderr/out and zend_fprintf ?
| From: | Hans Zaunere | Date: | Wed, 07 May 2003 15:22:23 +0000 |
| Subject: | Re: streams, stderr/out and zend_fprintf ? | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-1356@lists.php.net to get a copy of this message | ||
Hi Sascha,
--- Sascha Schumann <sascha@schumann.cx> wrote:
> Hans,
>
> If you are talking to a serial device, just use posix
> open. Handling resources is easy, the necessary API calls
> boil down to this:
>
> static int le_mcrypt;
>
> le_mcrypt =
> zend_register_list_destructors_ex(php_mcrypt_module_dtor,
> NULL, "mcrypt", module_number);
>
> ZEND_REGISTER_RESOURCE (return_value, td, le_mcrypt);
>
> ZEND_FETCH_RESOURCE (td, MCRYPT, mcryptind, -1, "MCrypt",
> le_mcrypt);
I think in this case standard POSIX calls (on the serial end) is the way to
go. I've been modeling how resources are handled in ext/mysql and what you
have above jibes with what I'm doing, so I'm happy :)
One note, though, is that the documentation for resources
(http://us2.php.net/manual/en/zend.variables.resource.php) seems to clash a
bit with what you have Sascha and what ext/mysql does. Perhaps it's simply
that I'm not familiar enough with it, but AFAIK there is no
zend_register_resource_destructors_ex() and the return value of
ZEND_REGISTER_RESOURCE() isn't caught. Anyway, maybe this is worth taking a
look at.
Thank you,
Hans