why these code cause compile error?
| From: | 张心灵 | Date: | Wed, 05 Nov 2008 09:07:31 +0000 |
| Subject: | why these code cause compile error? | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-41680@lists.php.net to get a copy of this message | ||
I 'am a new guy of php internal, I tried to define a class in extension
just for a attempt.
PHP_MINIT_FUNCTION(zhangjianyu)
{
/* If you have INI entries, uncomment these lines
REGISTER_INI_ENTRIES();
*/
zend_class_entry ce;
INIT_CLASS_ENTRY(ce, WPS_CLASS_NAME, php_wps_method_functions);
php_wps_sc_entry = zend_register_internal_class(&ce TSRMLS_CC);
zend_declare_class_constant_double(php_wps_sc_entry, "VERSION",
sizeof("VERSION"), 1.32 TSRMLS_DC);
zend_declare_class_constant_string(php_wps_sc_entry, "NAME",
sizeof("NAME"), "say say" TSRMLS_DC);
return SUCCESS;
}
The Code above will cause compile errors like this: error C2059: syntax
error : 'type', just indicate the line
zend_declare_class_constant_double(php_wps_sc_entry, "VERSION",
sizeof("VERSION"), 1.32 TSRMLS_DC); is not correct.
Either I use zend_declare_class_constant_double or
usezend_declare_property_null(php_wps_sc_entry, "name", strlen("name"),
ZEND_ACC_PUBLIC TSRMLS_DC),both of them will cause the same error : error
C2059: syntax error : 'type'