Re: When will the extension and embedding APIs ever be cleaned or documented?

From: Date: Fri, 14 Feb 2014 09:54:00 +0000
Subject: Re: When will the extension and embedding APIs ever be cleaned or documented?
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-72586@lists.php.net to get a copy of this message
On Fri, Feb 14, 2014 at 1:17 AM, Kevin Ingwersen <ingwie2000@googlemail.com>wrote: > Am Fr. Feb. 14 2014 00:04:01 schrieb Johannes Schlüter: > > Mind: "Compatibility is a feature." (Bjarne Stroustrup) The fact that 10 > > years old extensions can be used with php git master with quite little > > work is not only a help for old users but also promise to new users that > > their investment won't be lost easily. > > But what if there was something like a wrapper above the old api, to give > it a cleaner appearance, so people could choose to work with the newer, or > older, API? > > BTW, in the API "book", I dont find what I am looking for; storing a > forgein thing into the object. Like if I was to write a PHP module that > exports a PHP class, I would like to create a class instance to a C++ > class, and store that instance within the php object (struct?). Like: > > zval* this = getThis(); > MyClass* mc = (MyClass*)get_pointer_from_zvalthis); > > And, well, vice-versa. > This is covered in http://www.phpinternalsbook.com/classes_objects/custom_object_storage.htmland http://www.phpinternalsbook.com/classes_objects/custom_object_storage.html#overriding-create-objectin particular :) In the code sample there you'd replace "long additional_property" with "MyClass *my_class" (and add a delete call in the free_storage handler and a new call in create_object). Nikita

« previous php.internals (#72586) next »