Hello Bill,

Thursday, April 29, 2004, 7:26:49 AM, you wrote:

> (Win XP Pro, PHP 5 RC 1, Visual C++ .NET)

> Hi,

> I'm trying to create an extension which calls a function defined in a PHP
> script. The name of this function is "someFunction".

> My code is here:

> zval **params[2], *func_name, *retval_ptr;

It must be zval *params[2] (only one *)
And func_name (not *)

> CLS_FETCH();
what does it do? I hope it does the following which is needed:
fetch a zval into zval params[0] and zval params[1]
> ZVAL_STRING(func_name, "someFunction", 1);
change that to ZVAL_STRING(&func_name, 'someFunc', 0)
(notice & and 0 above)
and don't free func_name, that's unneeded overhead after these changes

> ZVAL_LONG(*params[0], 32);
> ZVAL_STRING(*params[1], "meters", 1);

> if (call_user_function(CG(function_table), NULL, func_name,&retval_ptr,
here you need &func_name, too
> 2,params) == SUCCESS) {
>     zval_ptr_dtor(&retval_ptr);
> }

> When I compile this I get an error saying
> c:\Documents and Settings\Bill
> Zeller\Desktop\testing\phui\phui_ext\phui_ext\phui_ext.cpp(121): error
> C2198: 'call_user_function' : too few actual parameters

> I don't know why this happens, because I'm using the arguments as described
> in the definition on line 298 of zend_API.h:

> ZEND_API int call_user_function(HashTable *function_table, zval **object_pp,
> zval *function_name, zval *retval_ptr, zend_uint param_count, zval *params[]
> TSRMLS_DC);

> Thanks for your help,

> Best Regards,
> Bill Zeller




-- 
Best regards,
 Marcus                            mailto:[EMAIL PROTECTED]

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to