Re: CodeGen_PECL int pass-by-reference

From: Date: Thu, 13 Sep 2007 12:56:22 +0000
Subject: Re: CodeGen_PECL int pass-by-reference
References: 1 2 3 4  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-27923@lists.php.net to get a copy of this message
On Sep 13, 2007, at 1:51 AM, Bertrand Mansion wrote:
You should ask your questions on the PECL list since they are not related to CodeGen_PECL. For such functions, I'd recommend writing a wrapper function, which means you'd have to change the API a bit. In this case, I think the function should return a resource, not an int. In fact, the nc_open() C function should be used inside another function and which in turn would return a resource. IIRC, that's how the sqlite wrapper for PDO does, for example. I think pretty much every PHP extension does so. You might want to have a look at other extensions and how they open files and return a PHP resource.
Well, no, actually my question does have to do with CodeGen_PECL, because I want to know what the <function> tag and contents will look like to do this. I'd considered making the PHP function behave differently than the C function, it does seem it would be more PHP-like, but there are a number of obvious advantages to mimicking the function exactly. Namely, we've already got developers that are familiar with the C API, so it reduces the learning curve, also I wouldn't have to re-write any documentation if it behaves exactly like the C functions, which SHOULD be possible. So, to ask again, I want to know what the <function> tag, specifically the <proto> and <code> tags would look like if you wanted to do pass-by-reference (and get a modified value back) in one of the parameters. That's the question. Perhaps I've overcomplicated it with a real-world example, but that is what I want to know. Thanks.

« previous php.pear.general (#27923) next »