|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
Class members in PHP extensions
I have made my first extension for PHP recently, and faced this challange: Make the extension act as a PHP class, and have some handles or private members in it, that can be stored acress calls to methods of my class.
I have solved it by creating a handle and saving it as a resource, and then using update_hash_index to store the resource zval in object's property table at index 0. This soulution works, but since it is necessary to first fetch the resource handle from object properties, then fetch the actual handle from resource list, this approach seems inefficient. The overhead of fetching is considerable when methods are called inside a loop. I am looking for a better way to do this, but I am not very familiar with developing PHP extensions and I was unable to find much documentation. I hope that somebody can guide me in the right direction. |
|
#3
|
|||
|
|||
|
Is this a program for a class?
There's someone else asking a very similar question in the current thread: "Sending an object refrence?" You might see if that thread gives you some ideas. |
|
#4
|
|||
|
|||
|
Onslaught <- is "dir" an extension to PHP? I didn't seem to have any luck finding it in the PHP source distro.
7stud <- I have read the thread, you refer to, but it seems to be concearned with passing objects in C/C++ rather than creating/storing/retrieving members in PHP classes, that are implemented as extensions. |
|
#5
|
|||
|
|||
|
operator smooth,
The word "dir" is a link in Onslaught's post. Just click on it. |
|
#6
|
|||
|
|||
|
I did
![]() |
|
#7
|
||||
|
||||
|
It isn't an extension, it would be in the bulk of the main source code.
|
|
#8
|
|||
|
|||
|
Oh... well, then I don't think I can use it, becouse my extension is a loadable module, it is not inserted into the core of PHP...
|
|
#9
|
||||
|
||||
|
You should still be able to use the source as a reference as to how to handle the class members, but this is just a suggestions.
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages > C Programming > Class members in PHP extensions |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|