From 2f8781979d3c9c917021fd8b7f15ead6ebc22519 Mon Sep 17 00:00:00 2001 From: Gwynne Raskind Date: Sun, 9 Mar 2008 20:38:44 +0000 Subject: [PATCH] real-world example, need to backport this example to its own section for use throughout the docs git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@254717 c90b9560-bf6c-de11-be94-00142212c4b1 --- internals2/structure/modstruct.xml | 95 +++++++++++++++++++++++++++++- 1 file changed, 93 insertions(+), 2 deletions(-) diff --git a/internals2/structure/modstruct.xml b/internals2/structure/modstruct.xml index b5a8f131f3..7c0166cc6d 100644 --- a/internals2/structure/modstruct.xml +++ b/internals2/structure/modstruct.xml @@ -1,5 +1,5 @@ - + The zend_module structure @@ -456,7 +456,98 @@ struct _zend_module_entry { - + + + Filling in the structure in a practical situation + + + With all these fields to play with, it can be confusing to know which to use + for what purpose. Here is the zend_module definition from + a "real-world" example extension. This extension provides a + counter that increases by one every time the function to get its current + value is called. The time at which the counter is reset is controlled by an + INI switch. This is useless in a practical sense, but serves to illustrate + many techniques for extension writing. + + + + Counter extension module definition + + + + + + + + + STANDARD_MODULE_HEADER is used since this module + doesn't define any dependencies. + + + + + + "counter" is the extension's name, and is used to define the + various callback functions the module passes to Zend. + + + + + + It is assumed that there is a variable of type + zend_function_entry * named + counter_functions earlier in the file that contains + the module definition, listing the functions the module exports to + userspace. + + + + + + NO_VERSION_YET is a particularly nice way of telling + Zend the module doesn't have a version. It might have been more correct to + place "1.0" here instead in a real module. + + + + + + This module has no post-deactivate function, so &null; is used. + + + + + + Since this module does use globals, + STANDARD_MODULE_PROPERTIES_EX is used to finish the + structure. + + + + + + +