Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:61572 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 72424 invoked from network); 20 Jul 2012 16:43:59 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Jul 2012 16:43:59 -0000 Authentication-Results: pb1.pair.com header.from=adamjonr@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=adamjonr@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.214.170 as permitted sender) X-PHP-List-Original-Sender: adamjonr@gmail.com X-Host-Fingerprint: 209.85.214.170 mail-ob0-f170.google.com Received: from [209.85.214.170] ([209.85.214.170:45318] helo=mail-ob0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id FD/C8-18983-ECA89005 for ; Fri, 20 Jul 2012 12:43:58 -0400 Received: by obfk16 with SMTP id k16so5979338obf.29 for ; Fri, 20 Jul 2012 09:43:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=Jose9Kr9v60PxUcvII8cZ1iz29wrR+0PGXhFpcyjsv8=; b=rmCDfskeUR8fPIAKk29li1j2lOyC8PEyLrr0eQO2/kb874Tps44F7ltHtNkXeOXdWx 5KRugc4PQZfbjfH9Uxlt2ibBNHfuRAjvjmUMyofOoF5wbN8/YFpCdRbQXVtTWXjENB+g GQkAW2/pLrgXmAYNwhribQkFTCNwOuwZUQSf7mcSch7YAdLjl9cwe918i8jT2nRoxsHJ VZbjRkRCtlLOUYTCAxwByTnYGIEN1+TphgWtuhJ4QPEVRrSKGVJS6AuTc88OjoryEZqC 5QlfB2xnNoYHT6mOTIuKGrY0MmhMThUJsquouAiLhtdpRAGhjkJkqrhs06jf3ZEQWNqB xAbg== MIME-Version: 1.0 Received: by 10.182.207.39 with SMTP id lt7mr8028771obc.67.1342802634735; Fri, 20 Jul 2012 09:43:54 -0700 (PDT) Received: by 10.76.116.168 with HTTP; Fri, 20 Jul 2012 09:43:54 -0700 (PDT) In-Reply-To: References: Date: Fri, 20 Jul 2012 12:43:54 -0400 Message-ID: To: internals@lists.php.net Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [PHP-DEV] Recommended way to create a zval that serves as a callback in an extension From: adamjonr@gmail.com (Adam Jon Richardson) On Thu, Jul 19, 2012 at 2:49 PM, Sara Golemon 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!