xref: /PHP-5.5/README.EXTENSIONS (revision f496aac1)
1This file describes extension module API details. Refer to
2README.EXT_SKEL to create extension skeleton files. Refer to
3Hacker's Guide for PHP internals.
4
5http://www.php.net/manual/en/internals2.php
6
7
8
9Between PHP 4.0.6 and 4.1.0, the Zend module struct changed in a way
10that broke both source and binary compatibility.  If you are
11maintaining a third party extension, here's how to update it:
12
13If this was your old module entry:
14
15zend_module_entry foo_module_entry = {
16    "foo",                /* extension name */
17    foo_functions,        /* extension function list */
18    NULL,                 /* extension-wide startup function */
19    NULL,                 /* extension-wide shutdown function */
20    PHP_RINIT(foo),       /* per-request startup function */
21    PHP_RSHUTDOWN(foo),   /* per-request shutdown function */
22    PHP_MINFO(foo),       /* information function */
23    STANDARD_MODULE_PROPERTIES
24};
25
26Here's how it should look if you want your code to build with PHP
274.1.0 and up:
28
29zend_module_entry foo_module_entry = {
30#if ZEND_MODULE_API_NO >= 20010901
31    STANDARD_MODULE_HEADER,
32#endif
33    "foo",                /* extension name */
34    foo_functions,        /* extension function list */
35    NULL,                 /* extension-wide startup function */
36    NULL,                 /* extension-wide shutdown function */
37    PHP_RINIT(foo),       /* per-request startup function */
38    PHP_RSHUTDOWN(foo),   /* per-request shutdown function */
39    PHP_MINFO(foo),       /* information function */
40#if ZEND_MODULE_API_NO >= 20010901
41    PHP_FOO_VERSION,      /* extension version number (string) */
42#endif
43    STANDARD_MODULE_PROPERTIES
44};
45
46If you don't care about source compatibility with earlier PHP releases
47than 4.1.0, you can drop the #if/#endif lines.
48