Re: Recommended way to create a zval that serves as a callback in an extension

From: Date: Fri, 20 Jul 2012 16:43:54 +0000
Subject: Re: Recommended way to create a zval that serves as a callback in an extension
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-61572@lists.php.net to get a copy of this message
On Thu, Jul 19, 2012 at 2:49 PM, Sara Golemon <pollita@php.net> wrote: > Same as you would in PHP code. Make an IS_STRING pointing at a global > function, or IS_ARRAY pointing at a class method, or an IS_OBJECT supporting > __invoke(). If you're asking how you can call a C function directly via > this callback: You can't. You can can, however, make an internal method to > use as a callback, just bear in mind it'll be callable by userspace as well. Thank you very much for your explanation, Sara. I got my code working, but I must confess I wasn't confident it was the preferred approach and I wanted to make sure I was learning the recommended approach. I've taken to heart the many examples in your book where you bring up the most obvious/likely method to do something in the extension world only to find out it's not the preferred/correct approach. Thank you very much for the clarification. Adam P.S. - Your book has aged exceedingly well, and it's a great reference for people like me trying to find their way around the internals :) Nice writing style!

« previous php.internals (#61572) next »