Calling Parent Constructor from Extending Class
| From: | Mark Skilbeck | Date: | Fri, 24 Sep 2010 20:22:30 +0000 |
| Subject: | Calling Parent Constructor from Extending Class | ||
| Groups: | php.pecl.dev | ||
| Request: | Send a blank email to pecl-dev+get-7687@lists.php.net to get a copy of this message | ||
Hi, All.
So, I'm wrapping libnotify as my first extension, and would like to extend GObject for PHP's GObject class so that I can use the signal functionality of it (libnotify's NotifyNotification class does this - so I should, too).
Now, before I tried implementing this, I simply had the create_object member point to my 'new'[1] function to set up the object[2].
I then went on to having my Notification class extend the GObject class by doing:
zend_register_internal_class_ex(..., gobject_ce_gobject, ...)
Using reflection I can see that my class properly inherits the methods of GObject. However, they segfault. This is, I believe, caused because GObject class hasn't been initialized. I stuck a printf() in the GObject 'new' method[3], and received no output.
How should I go about doing this? Is there a design flaw here, because I cannot think of a way to do this? Or I may just be too tired and overlooking something. Or I may just suck.
Let me know!
[1] http://bitbucket.org/mahcuz/notify/src/tip/notification.c#cl-47
[2] http://bitbucket.org/mahcuz/notify/src/tip/php_notify.h#cl-30
[3] http://bitbucket.org/indeyets/gobject-for-php/src/tip/gobject_gobject_class.c#cl-97
--
Mark Skilbeck
mahcuz.com | gtk.php.net | pecl.php.net/cairo | docs.php.net