Declaring php-class static member functions from within C/C++

From: Date: Fri, 17 Mar 2006 20:00:57 +0000
Subject: Declaring php-class static member functions from within C/C++
Groups: php.internals 
Request: Send a blank email to internals+get-22509@lists.php.net to get a copy of this message
If I define/declare php class methods via: INIT_CLASS_ENTRY(ce, phpclassname, myclassmethods); where myclassmethods is defined as eg: function_entry myclass::myclassmethods[] = { PHP_ME(myclass, __construct, arginfo_Guid__construct, ZEND_ACC_PUBLIC) PHP_ME(myclass, getValue, NULL, ZEND_ACC_PUBLIC) }; then getValue is a member function of an instantiated object, Unsurprisingly, attempting to call myclass::getValue() therefore generates a: "Non-static method myclass::getValue() cannot be called statically" error, even where no dependency on the object (via getThis()) is required. How then can I inform zend/php of my intent to supply a static member function, such that I can call for example myclass::somestaticfunc() I can clearly create global functions, viz: myclass_somestaticfunc() but these would all apparently need to be declared in the module function entry. A neater solution would be to declare static member functions pertinent to the class, either by flagging them as static, or suppling a second function_entry to a 'static member functions *' in class_entry. Php clearly tolerates static member functions in its own php-defined classes. Is there a declaration mechanism available to declare them from within C/C++? Cheers, Andrew.

« previous php.internals (#22509) next »