RE: [PHP-DEV] ? calling a module function from another module...

From: Date: Tue, 09 Jan 2001 12:37:52 +0000
Subject: RE: [PHP-DEV] ? calling a module function from another module...
Groups: php.dev 
Request: Send a blank email to php-dev+get-43544@lists.php.net to get a copy of this message
I've managed to call another modules function, including passing of parameters... Since I'm not really at home yet developing for PHP, could anyone give me some advice, pointers, tips, do's and don'ts about the code I used to do this??? [...] zval * parametername; zval * retval_ptr_ptr; zend_function_state function_state; int number_of_arguments; MAKE_STD_ZVAL(parametername); ZVAL_STRING(parametername, "localhost", 1); retval_ptr_ptr = NULL; if (zend_hash_find(&module_registry, "mysql", strlen("mysql")+1, (void**)&module) == FAILURE) { return; } if (zend_hash_find(EG(function_table), "mysql_connect", strlen("mysql_connect")+1, (void **) &function_state.function)==FAILURE) { zend_error(E_ERROR, "Unknown function: mysql_connect()\n"); } zend_ptr_stack_push(&EG(arg_types_stack), NULL); number_of_arguments=1; zend_ptr_stack_n_push(&EG(argument_stack), number_of_arguments+2, parametername, number_of_arguments, NULL); ALLOC_INIT_ZVAL(retval_ptr_ptr); ((zend_internal_function *) function_state.function)->handler(number_of_arguments, retval_ptr_ptr, NULL, 1 ELS_CC); [...] Thanks, Marc.

« previous php.dev (#43544) next »