On 11/11/2006 04:13 AM, Arnold Daniels wrote:
> Hi,
>
> I've noticed that building an extension will fail when using macro
> php_stream_from_zval and there is not return_value variable within the
> scope.
Well, looks like it's time to install cscope or ctags and use it to see which code actually stands behind a particular macro.
----
#define php_stream_from_zval(xstr, ppzval) ZEND_FETCH_RESOURCE2((xstr), php_stream *, (ppzval), -1, "stream", php_file_le_stream(), php_file_le_pstream())
#define ZEND_FETCH_RESOURCE2(rsrc, rsrc_type, passed_id, default_id, resource_type_name, resource_type1, resource_type2) \
rsrc = (rsrc_type) zend_fetch_resource(passed_id TSRMLS_CC, default_id, resource_type_name, NULL, 2, resource_type1, resource_type2); \
ZEND_VERIFY_RESOURCE(rsrc);
#define ZEND_VERIFY_RESOURCE(rsrc) \
if (!rsrc) { \
RETURN_FALSE; \ <------------ nb
}
----
Obviously this macro is not what you need.
I guess you need zend_fetch_resource(), which is the function actually used in ZEND_FETCH_RESOURCE2().
--
Wbr,
Antony Dovgal