xref: /PHP-5.6/ext/skeleton/php_skeleton.h (revision dcfd7531)
1 /* __header_here__ */
2 
3 #ifndef PHP_EXTNAME_H
4 #define PHP_EXTNAME_H
5 
6 extern zend_module_entry extname_module_entry;
7 #define phpext_extname_ptr &extname_module_entry
8 
9 #define PHP_EXTNAME_VERSION "0.1.0" /* Replace with version number for your extension */
10 
11 #ifdef PHP_WIN32
12 #	define PHP_EXTNAME_API __declspec(dllexport)
13 #elif defined(__GNUC__) && __GNUC__ >= 4
14 #	define PHP_EXTNAME_API __attribute__ ((visibility("default")))
15 #else
16 #	define PHP_EXTNAME_API
17 #endif
18 
19 #ifdef ZTS
20 #include "TSRM.h"
21 #endif
22 
23 /*
24   	Declare any global variables you may need between the BEGIN
25 	and END macros here:
26 
27 ZEND_BEGIN_MODULE_GLOBALS(extname)
28 	long  global_value;
29 	char *global_string;
30 ZEND_END_MODULE_GLOBALS(extname)
31 */
32 
33 /* In every utility function you add that needs to use variables
34    in php_extname_globals, call TSRMLS_FETCH(); after declaring other
35    variables used by that function, or better yet, pass in TSRMLS_CC
36    after the last function argument and declare your utility function
37    with TSRMLS_DC after the last declared argument.  Always refer to
38    the globals in your function as EXTNAME_G(variable).  You are
39    encouraged to rename these macros something shorter, see
40    examples in any other php module directory.
41 */
42 
43 #ifdef ZTS
44 #define EXTNAME_G(v) TSRMG(extname_globals_id, zend_extname_globals *, v)
45 #else
46 #define EXTNAME_G(v) (extname_globals.v)
47 #endif
48 
49 #endif	/* PHP_EXTNAME_H */
50 
51 /* __footer_here__ */
52