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

From: Date: Fri, 14 Feb 2014 01:02:37 +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-72577@lists.php.net to get a copy of this message
On Fri, 2014-02-14 at 01:17 +0100, Kevin Ingwersen 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? Well, there wasn't a satisfiable API proposed, yet. The current "API" is quite wide making it hard to wrap without requiring too much "escape points". There are projects like https://github.com/moriyoshi/boost.php though. (Last change 4 years ago ...) In the end: Once people are used to it it isnot toooo much of a urden to use the existing interface in most cases. > 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. Maybe this helps: http://talks.somabo.de/200903_montreal_php_extension_writing.pdf starting ca. slide 89. Mind that this might be a bit outdated, property handling changed a tiny bit, the UPRADING.INTERNALS file in a recent PHP distribution should have details if you run into issues ... ignore the comment on the UPGRADING file ... I can't seem to find the relevant reference .. damn ... notably direct manipulation of properties via zend_hash_copy as on slide 90 is to be replaced with object_properties_init(), if you hit issues there please ask again and I (or maybe/hopefully somebody else) can dig deeper and help more. > Otherwise, that phpinternalsbook is very detailed, and I like how its > written :) > > Although its no real PHP project - why not just link it in the php.net > docs? o.o That probably might be done, I'd prefer integration so more people can update it ... I myself wasn't aware of the existence before. johannes

« previous php.internals (#72577) next »