Re: Is it the right way to pass an argument to callback?
| From: | Ruslan Osmanov | Date: | Thu, 15 Dec 2011 18:24:07 +0000 |
| Subject: | Re: Is it the right way to pass an argument to callback? | ||
| References: | 1 2 3 4 | Groups: | php.pecl.dev |
| Request: | Send a blank email to pecl-dev+get-8976@lists.php.net to get a copy of this message | ||
On 12/15/2011 11:08 PM, Johannes Schlüter wrote:
On https://github.com/johannes/php-test-helpers/blob/master/test_helpers.c#L342 you can see how I do it. (see the ADDREFs etc.) sorry too busy to look deeper (and in general I prefer if people CC the list so it gets archived, or others can learn/extend/fix answers ;-) ) johannesHey, thank you very much! Just gotta add refs to zval members, and all works. I wonder why nobody said these simple words on the IRC. -- Regards, Ruslan Osmanov http://osmanov-dev-notes.blogspot.com | @ruslan_osmanov | +998739502399I'm trying to make it parsing callbacks with "f". But zend_fcall_info * and zend_fcall_info * pointers live within PHP_FUNCTION() only. If I save them to an insatnce of struct asphp_eio_cb_t *eio_cb = ecalloc(1, sizeof(php_eio_cb_t)); eio_cb->fci = emalloc(sizeof(zend_fcall_info)); eio_cb->fcc = emalloc(sizeof(zend_fcall_info_cache)); *eio_cb->fci = *fci_ptr; *eio_cb->fcc = *fcc_ptr;and put into some call(..., my_callback, eio_cb); static void my_callback(data) { /* data->fci and data->fcc contain garbage */ } So I merely want to preserve fcall info until my_callback is called. Tried to get answer on the IRC with no luck. -- Regards, Ruslan Osmanov