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 <[email protected]>: > 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 > > >
