Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:22509 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 1812 invoked by uid 1010); 17 Mar 2006 20:01:02 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 1797 invoked from network); 17 Mar 2006 20:01:01 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Mar 2006 20:01:01 -0000 X-Host-Fingerprint: 194.73.73.211 c2bthomr03.btconnect.com FreeBSD 4.7-5.2 (or MacOS X 10.2-10.3) (2) Received: from ([194.73.73.211:17361] helo=c2bthomr03.btconnect.com) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id 21/E9-55982-C751B144 for ; Fri, 17 Mar 2006 15:01:00 -0500 Received: from va517slx (host81-134-174-53.in-addr.btopenworld.com [81.134.174.53]) by c2bthomr03.btconnect.com (MOS 3.5.9-GR) with ESMTP id ELZ43070; Fri, 17 Mar 2006 20:00:17 GMT To: internals@lists.php.net Date: Fri, 17 Mar 2006 20:00:57 +0000 User-Agent: KMail/1.8 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-ID: <200603172000.57714.an.dromeda@btconnect.com> Subject: Declaring php-class static member functions from within C/C++ From: an.dromeda@btconnect.com 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.