first commit
[php-ancillary.git] / php-ancillary.c
1 #ifdef HAVE_CONFIG_H
2 #include "config.h"
3 #endif
4 #include "php.h"
5  
6 #define PHP_ANCILLARY_VERSION "1.0"
7 #define PHP_ANCILLARY_EXTNAME "ancillary"
8  
9 extern zend_module_entry ancillary_module_entry;
10 #define phpext_ancillary_ptr &ancillary_module_entry
11  
12 // declaration of a custom mop_function()
13 PHP_FUNCTION(mop_function);
14  
15 // list of custom PHP functions provided by this extension
16 // set {NULL, NULL, NULL} as the last record to mark the end of list
17 static function_entry mop_functions[] = {
18     PHP_FE(mop_function, NULL)
19     {NULL, NULL, NULL}
20 };
21  
22 // the following code creates an entry for the module and registers it with Zend.
23 zend_module_entry ancillary_module_entry = {
24 #if ZEND_MODULE_API_NO >= 20010901
25     STANDARD_MODULE_HEADER,
26 #endif
27     PHP_ANCILLARY_EXTNAME,
28     mop_functions,
29     NULL, // name of the MINIT function or NULL if not applicable
30     NULL, // name of the MSHUTDOWN function or NULL if not applicable
31     NULL, // name of the RINIT function or NULL if not applicable
32     NULL, // name of the RSHUTDOWN function or NULL if not applicable
33     NULL, // name of the MINFO function or NULL if not applicable
34 #if ZEND_MODULE_API_NO >= 20010901
35     PHP_ANCILLARY_VERSION,
36 #endif
37     STANDARD_MODULE_PROPERTIES
38 };
39  
40 ZEND_GET_MODULE(ancillary)
41  
42 // implementation of a custom mop_function()
43 PHP_FUNCTION(mop_function)
44 {
45     RETURN_STRING("This is my function", 1);
46 }