Fwd: [PECL-DEV] problems compiling new PECL module
| From: | Tim Gustafson | Date: | Sun, 09 Jan 2011 03:47:26 +0000 |
| Subject: | Fwd: [PECL-DEV] problems compiling new PECL module | ||
| References: | 1 2 3 4 | Groups: | php.pecl.dev |
| Request: | Send a blank email to pecl-dev+get-7928@lists.php.net to get a copy of this message | ||
> That seems to work, and calling SetSourceModule returns TRUE, but then
> when I call GetValue, PHP core dumps. I'm guessing that the value
> being returned by zend_object_store_get_object is invalid. Am I
> calling zend_object_store_get_object correctly?
I think I've gotten past this now. SetSourceModule appears to be
working properly.
However, the GetSourceModule function is not working because I don't
understand how to embed a C++ object into a zval.
At precent, I've got:
----------
PHP_METHOD(Noise_Abs, GetSourceModule) {
noise::module::Abs *noise_abs = NULL;
noise_module_object *obj = (noise_module_object
*)zend_object_store_get_object(getThis() TSRMLS_CC);
noise_abs = (noise::module::Abs*)obj->noise_module;
int i;
zval *z;
const noise::module::Module *m = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &i) == FAILURE) {
RETURN_NULL();
}
if (noise_abs != NULL) {
m = &noise_abs->GetSourceModule(i);
ALLOC_INIT_ZVAL(z);
Z_TYPE_P(z) = IS_OBJECT;
RETURN_ZVAL(z, 1, 0);
}
RETURN_NULL();
}
----------
Basically, I want to return "m" as an object to the caller. I've tried:
Z_OBJVAL_P(z) = m;
but that errors with:
noise_abs.h:98: error: no match for 'operator=' in
'z->_zval_struct::value._zvalue_value::obj = m'
Which macro should I be using to return this object to PHP?
--
Tim Gustafson
tjg@tgustafson.com
831-332-1496
http://tgustafson.com/