Hi,
        I'm trying to write a class as a PHP C extension.  I want to add a member
variable to class declaration time.  I believe this is possible by adding to
the zend_class_entry's default_properties HashTable.  My attempts so far
have resulted in apache core dumps.  My code for PHP_MINIT_FUNCTION look
like:


   zend_class_entry MyClass_class_entry;
   char *cv2;

   INIT_CLASS_ENTRY(MyClass_class_entry, "MyClass",
                    MyClass_class_funcs);
   MyClass_class_entry_ptr =
zend_register_internal_class(&MyClass_class_entry);

   fprintf(stderr,"Registered class with name
'%s'\n",MyClass_class_entry_ptr->name);
   zend_hash_update(&MyClass_class_entry_ptr->default_properties,
                    "memvar", 7,
                    "member value", 13,
                    (void **) &cv2);

   fprintf(stderr,"made MyClass::memvar point to '%s'\n", cv2);

However, I get coredumps on apache startup.

What is the correct way to register member variables at class declaration
time?

thanks
dave


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

Reply via email to