From 8f6738ea086ed3b24b154e527749bc0115991abd Mon Sep 17 00:00:00 2001 From: Gwynne Raskind Date: Wed, 27 Jun 2007 21:31:12 +0000 Subject: [PATCH] A couple of pages of new material. Committing now simplifies necessary changes to fix internals errors. git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@238740 c90b9560-bf6c-de11-be94-00142212c4b1 --- internals2/structure/files.xml | 4 +- internals2/structure/modstruct.xml | 100 ++++++++++++++++++++++++++++- 2 files changed, 100 insertions(+), 4 deletions(-) diff --git a/internals2/structure/files.xml b/internals2/structure/files.xml index 36fb1c1bce..03df6cb2e2 100644 --- a/internals2/structure/files.xml +++ b/internals2/structure/files.xml @@ -1,11 +1,11 @@ - + Files which make up an extension Whether created by hand, using ext_skel, or by an alternate extension generator, such as - CodeGen, + CodeGen, all extensions will have at least four files: diff --git a/internals2/structure/modstruct.xml b/internals2/structure/modstruct.xml index 77f4857085..0ffb029d4b 100644 --- a/internals2/structure/modstruct.xml +++ b/internals2/structure/modstruct.xml @@ -1,8 +1,104 @@ - + The zend_module structure - + + The main source file of a PHP extension contains several new constructs for + a C programmer. The most important of these, the one touched first when + starting a new extension, is the zend_module structure. + This structure contains a wealth of information that tells the Zend Engine + about the extension's dependencies, version, callbacks, and other critical + data. The structure has mutated considerably over time; this section will + focus on the structure as it has appeared since PHP 5.0, and will identify + the very few parts which have changed in PHP 5.1 and 5.2. + + + + The zend_module declaration from + example.c looks like this before any code has been + written (the example file was generated by + ext_skel --extname=example): + + + + zend_module declaration in an example extension + += 20010901 + STANDARD_MODULE_HEADER, +#endif + "example", + example_functions, + PHP_MINIT(example), + PHP_MSHUTDOWN(example), + PHP_RINIT(example), /* Replace with NULL if there's nothing to do at request start */ + PHP_RSHUTDOWN(example), /* Replace with NULL if there's nothing to do at request end */ + PHP_MINFO(example), +#if ZEND_MODULE_API_NO >= 20010901 + "0.1", /* Replace with version number for your extension */ +#endif + STANDARD_MODULE_PROPERTIES +}; +/* }}} */ +]]> + + + + + This may look a bit daunting at first glance, but most of it is very simple + to understand. Here's the declaration of zend_module from + zend_modules.h in PHP 5.2, along with a few relevant + nearby constants: + + + + zend_module definition in PHP 5.2 + + + + +