Re: [PHP4BETA] access to $this->myvar from C
| From: | Andrei Zmievski | Date: | Tue, 01 Feb 2000 20:18:06 +0000 |
| Subject: | Re: [PHP4BETA] access to $this->myvar from C | ||
| References: | 1 2 | Groups: | php.version4 |
| Request: | Send a blank email to php-version4+get-9641@lists.php.net to get a copy of this message | ||
On Tue, 01 Feb 2000, php@home.uh.nu wrote:
> ok, so I'll pass in the $this var to the C wrapper call. Then I'll need
> to convert the pval point to an object ptr? convert_to_object(this_pval); ?
> and from there it has this_pval->ht to find and do a zend_hash_update
> on values?
I'd do something like this:
zval **myobj;
if (ARG_COUNT(ht) != blah || zend_get_parameters_ex(blah, &myobj, blah,
blah)== FAILURE) {
WRONG_PARAM_COUNT();
}
if ((*myobj)->type != IS_OBJECT) {
RETURN_FALSE;
}
add_assoc_bool(HASH_OF(*myobj), "test", 1);
> looking through zend.h I noticed that the last parameter on the
> INTERNAL_FUNCTION_PARAMETERS is zval *this_ptr. Is that already what I need?
> Can I access vars directly from that?
No, *this_ptr is used by class functions to get access to containing
object.
> Sorry about all the questions, I'm just trying to learn w/o the needed docs :)
You're right, the docs are sorely missed. We do plan to start work on
complete API documentation.
-Andrei
Complexity in the mind is not caused by learning;
learning is caused by complexity in the mind.
-- Steven Pinker