http://www.php.net/manual/en/zend.variables.resource.php

- Im sure thats improved alot since I first read it :)

regards
alan

fabwash wrote:

>Something went wrong in the format of my message!
>
>It should read:
>
>  
>
>>ZEND_FETCH_RESOURCE(resource_ptr, resource_struct *, resource_id, -1,
>>"resource", le_resource);
>>    
>>
>
>  
>
>>The first argument will be returned to the caller, that will be your
>>resource identification.
>>The second argument is a pointer to your resource (a zval, a struct, or
>>whatever).
>>The third argument is the resource destruction handler type.
>>    
>>
>
>Then
>  
>
>>ZEND_FETCH_RESOURCE(resource_ptr, resource_struct *, resource_id, -1,
>>"resource", le_resource);
>>
>>The first parameter will return your resource, the second is the type of
>>your resource, the third is what was returned in "return_value" and passed
>>back to the user, so that should be passed as an argument back to your
>>extension, -1 to say that there is no default resource, "resource" is just
>>    
>>
>a
>  
>
>>name that will be displayed if Zend cannot find your resource, and
>>le_resource is the resource type you got back when you registered the
>>resource destructor.
>>    
>>
>
>----- Original Message -----
>From: "fabwash" <[EMAIL PROTECTED]>
>To: <[EMAIL PROTECTED]>; "Joel Dudley" <[EMAIL PROTECTED]>
>Sent: Thursday, June 13, 2002 5:46 PM
>Subject: Re: [PHP-DEV] understanding resources
>
>
>  
>
>>http://www.php.net/manual/en/zend.variables.resource.php will be a
>>    
>>
>starting
>  
>
>>point.
>>
>>Basically you want to do this:
>>
>>1) Create a destruction handler for your resource:
>>
>>void my_destruction_handler(zend_rsrc_list_entry *rsrc TSRMLS_DC) {
>>}
>>
>>2) Register the destruction handler:
>>
>>    le_resource =
>>zend_register_resource_destructors_ex(my_destruction_handler, NULL,
>>"resource");
>>
>>1) and 2) are done once in the code (usually at startup).
>>
>>3) Register your resource
>>
>>ZEND_REGISTER_RESOURCE(return_value, resource_ptr, le_resource);
>>
>>Then when you need to get your resource, you will get the resource id as a
>>parameter from the caller, then call :
>>
>>ZEND_FETCH_RESOURCE(resource_ptr, resource_struct *, resource_id, -1,
>>"resource", le_resource);
>>
>>The first parameter will return your resource, the second is the type of
>>your resource, the third is what was returned in "return_value" and passed
>>back to the user, so that should be passed as an argument back to your
>>extension, -1 to say that there is no default resource, "resource" is just
>>    
>>
>a
>  
>
>>name that will be displayed if Zend cannot find your resource, and
>>le_resource is the resource type you got back when you registered the
>>resource destructor.
>>
>>If you don't want to return the resource to the caller but keep it as a
>>property of your object, that's another story, and I can help on that one
>>too if necessary.
>>
>>Fab.
>>
>>The first argument will be returned to the caller, that will be your
>>resource identification.
>>The second argument is a pointer to your resource (a zval, a struct, or
>>whatever).
>>The third argument is the resource destruction handler type.
>>
>>----- Original Message -----
>>From: "Joel Dudley" <[EMAIL PROTECTED]>
>>To: <[EMAIL PROTECTED]>
>>Sent: Thursday, June 13, 2002 12:37 PM
>>Subject: [PHP-DEV] understanding resources
>>
>>
>>    
>>
>>>Hello all,
>>>  I need to write a molecular visualization extension for PHP to
>>>      
>>>
>complete
>  
>
>>a
>>    
>>
>>>project I am working on. It will have to work somewhat like GD by
>>>      
>>>
>creating
>  
>
>>a
>>    
>>
>>>resource, having other functions operate on that resource, and then
>>>      
>>>
>output
>  
>
>>>an image. I have trouble finding a good explanation of resources in the
>>>      
>>>
>>PHP
>>    
>>
>>>docs. Perhaps I missed a section. Regardless, does anyone here know of a
>>>resource that explains resources in extensions? I think I will go over
>>>      
>>>
>the
>  
>
>>>GD source code for now, and perhaps that is the best answer to my
>>>      
>>>
>>question.
>>    
>>
>>>Thank you for reading my post.
>>>
>>>Joel Dudley
>>>Faculty Research Associate
>>>Arizona State University
>>>Kumar Laboratory of Evolutionary Functional Genomics
>>>http://lsweb.la.asu.edu/skumar/
>>>
>>>
>>>      
>>>
>>--
>>PHP Development Mailing List <http://www.php.net/>
>>To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>>    
>>
>
>  
>




-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to