Re: [PHP-DEV] how do you create a private property as an array in a class

2012-04-08 Thread Matthew Hernandez
On Sun, Apr 8, 2012 at 2:26 AM, Derick Rethans wrote: > On Sat, 7 Apr 2012, Matthew Hernandez wrote: > > > How can I valgrind my extension? Google isn't bringing up many php > > extension topics :/ > > On the shell: > > export USE_ZEND_ALLOC=0 > export ZEND_DONT_UNLOAD_MODULES=1 > valgrind php -d

Re: [PHP-DEV] how do you create a private property as an array in a class

2012-04-08 Thread Derick Rethans
On Sat, 7 Apr 2012, Matthew Hernandez wrote: > How can I valgrind my extension? Google isn't bringing up many php > extension topics :/ On the shell: export USE_ZEND_ALLOC=0 export ZEND_DONT_UNLOAD_MODULES=1 valgrind php -dextension=yourextension.so yourscript.php See for some more info here:

Re: [PHP-DEV] how do you create a private property as an array in a class

2012-04-07 Thread Matthew Hernandez
Thanks. How can I valgrind my extension? Google isn't bringing up many php extension topics :/ I can't figure out why I keep getting a seg fault: typedef struct _foo_object { zend_object std; zval *elements; } foo_object; static foo_object *foo_object_ptr; PHP_MINIT_FUNCTION(foo_class) {

Re: [PHP-DEV] how do you create a private property as an array in a class

2012-04-07 Thread Xinchen Hui
hi: You can refer to ext spl array Thanks Sent from my iPhone 在 2012-4-8,7:12,Matthew Hernandez 写道: > Here's what I have so far: > > typedef struct _foo_class_object { > zend_object std; > zval *elements; > int size; > } foo_class_object; > > static foo_class_object *foo_class_object_ptr; >

Re: [PHP-DEV] how do you create a private property as an array in a class

2012-04-07 Thread Matthew Hernandez
Here's what I have so far: typedef struct _foo_class_object { zend_object std; zval *elements; int size; } foo_class_object; static foo_class_object *foo_class_object_ptr; static zend_class_entry *foo_class_ptr; ZEND_METHOD(foo_class, __construct) { foo_class_object_ptr = (foo_class_obj

Re: [PHP-DEV] how do you create a private property as an array in a class

2012-04-07 Thread Matthew Hernandez
Hi Johannes, Yes I just found out that I should extend instead of the approach I was thinking about. So I created this: typedef struct _foo_object { zend_object std; zval *array; int size; } foo_object; So the question is how do I correctly pass foo_object around so that I can manipulate

Re: [PHP-DEV] how do you create a private property as an array in a class

2012-04-07 Thread Johannes Schlüter
Hi, On Sat, 2012-04-07 at 11:23 -0700, Matthew Hernandez wrote: > This is my first extension I'm working on. I'm trying to make a class > available to the user space with 1 private property that is an array. The first question is: Why? - Why add the overhead of creating such an array if it is pri