Re: Sharing resources between modules
| From: | Wez Furlong | Date: | Sat, 19 Apr 2003 10:51:36 +0000 |
| Subject: | Re: Sharing resources between modules | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-974@lists.php.net to get a copy of this message | ||
Yes, it is possible; you will need to know the list entry id in advance,
so it needs to be exported from one module either as a global variable
or as the return value from a function.
TSRMLS stuff is used in thread-safe builds as a means to reduce TLS
overhead; it will not affect you intended usage.
BTW: ZEND_REGISTER_RESOURCE and ZEND_FETCH_RESOURCE macros might make
your code slightly easier to write.
--Wez.
On Sat, 19 Apr 2003, Marshall A. Greenblatt wrote:
> Hi guys, a quick question:
>
> Is it possible for one module to retrieve the resource structure registered
> by another module?
>
> For instance, assume that we have two loaded PHP modules, `php_a.so' and
>
php_b.so'. A script calls a PHP function defined in
> php_a.so'. That
> function creates a structure, calls zend_register_resource(), and returns
> the resource ID. That same script then calls a PHP function defined in
> `php_b.so' that accepts the resource ID as a parameter. Would it be
> possible for the function in `php_b.so' to retrieve the structure associated
> with the resource ID registered in `php_a.so'?