Table of contents:

Resources Lists

int zend_register_list_destructors(void (*ld)(void *),
 void (*pld)(void *), int module_number);
int zend_register_list_destructors_ex(rsrc_dtor_func_t ld,
 rsrc_dtor_func_t pld, char *type_name,
 int module_number);

Registers a list entry and associate destructors with it. When an entry using the associated list type is removed from EG(reuglar_list), the non-persistent ld destructor function will be called. When such a persistent entry is removed, the pld destructor will be called instead.




Non-persistent destructor method.


Persistent destructor method.


Descriptive name for the resource type.


Hint to the engine on who owns this resource type. Should be passed unmodified from an MINIT method.

int zend_list_insert(void *ptr, int type);
int zend_register_resource(zval *result, void *ptr, int type);

Places a resource pointer into the EG(regular_list) HashTable and returns a numeric resource ID. zend_register_resource() goes an extra step further and populates that resource ID into a ZVAL for passing back to userspace code.




Arbitrary pointer resource to store


Registered type to associate with the resource and use for later destruction

result zval

to populate with the resource ID

int zend_list_addref(int id);
int zend_list_delete(int id);

Increases or decreases a given resource ID's reference count. Note that zend_list_delete() does not hard delete the resource, it only decreases the refcount and deletes in the event that refcount reaches zero.

void *zend_list_find(int id, int *type);
void *zend_fetch_resource(zval **zval_id TSRMLS_DC, int id,
 char *type_name, int *type, int num_types, ...);

Retrieves a resource from EG(regular_list) using the passed id or zval_id. The resource will be returned as a pointer or NULL if no matching resource can be found.




Numeric resource ID to locate.


If id is passed as -1, look for the resource ID encoded into this zval.


Populated with the numeric resource type located.


Populated with the textual name of the resource type located.


Number of valid resource types to match against this resource.


List of expected resource types. If the located resource does not match one of these types, it will not be considered a match.

int zend_fetch_list_dtor_id(char *type_name);

Returns the numeric resource type based on the requested type name.

char *zend_rsrc_list_get_rsrc_type(int resource TSRMLS_DC);

Returns the type name of the specified resource ID.

The PHP Life Cycle

Variables from the Inside Out

Memory Management

Setting Up a Build Environment

Your First Extension

Returning Values

Accepting Parameters

Working with Arrays and HashTables

The Resource Data Type

PHP4 Objects

PHP5 Objects

Startup, Shutdown, and a Few Points in Between

INI Settings

Accessing Streams

Implementing Streams

Diverting the Stream

Configuration and Linking

Extension Generators

Setting Up a Host Environment

Advanced Embedding

Appendix A. A Zend API Reference

Appendix B. PHPAPI

Appendix C. Extending and Embedding Cookbook

Appendix D. Additional Resources

Extending and Embedding PHP
Extending and Embedding PHP
ISBN: 067232704X
EAN: 2147483647
Year: 2007
Pages: 175
Authors: Sara Golemon © 2008-2020.
If you may any questions please contact us: