Re: Segfault when assigning a reference variable

From: Date: Fri, 07 Mar 2014 20:16:51 +0000
Subject: Re: Segfault when assigning a reference variable
References: 1 2  Groups: php.pecl.dev 
Request: Send a blank email to pecl-dev+get-11609@lists.php.net to get a copy of this message
I'm emulating the same behavior of wxWidgets since the code is being auto generated and I want to keep compatibility as much as possible with how wxWidgets works so people that comes from C++ world can use the extension with the same knowledge as that of original implementation. wxPHP is almost a 1 on 1 binding except for wxString which is a native php string and wxDateTime which is just a timestamp on wxphp. It is strange that the first call works and assings the buffer reference properly but second call fails. 2014-03-07 15:07 GMT-04:00 Johannes Schlüter <johannes@schlueters.de>: > Hi, > > On Fri, 2014-03-07 at 14:52 -0400, JGM wrote: > > I'm trying to implement a virtual method on wxphp that in C++ looks like: > > > > size_t wxInputStream::OnSysRead(void* buffer, size_t bufsize) > > > > so in php this method is implemented as: > > > > public function OnSysRead(&$buffer, $bufsize) > > Why do you need a reference here? You can return the buffer by value. > Copy on write will prevent unneeded copies and reference trouble and as > PHP strings are binary safe there is no need to transport the length > independently. > > johannes > > >

« previous php.pecl.dev (#11609) next »