| ||||||||||||||||||||||||
Declaration of the Zend Function BlockNow that you have declared the functions to be exported, you also have to introduce them to Zend. Introducing the list of functions is done by using an array of zend_function_entry. This array consecutively contains all functions that are to be made available externally, with the function's name as it should appear in PHP and its name as defined in the C source. Internally, zend_function_entry is defined as shown in Listing 9.5. Obrßzek 31-2. Listing 9.5. Internal declaration of zend_function_entry.
Note: You cannot use the predefined macros for the end marker, as these would try to refer to a function named "NULL"! The macro ZEND_FE simply expands to a structure entry in zend_function_entry. Note that these macros introduce a special naming scheme to your functions - your C functions will be prefixed with zif_, meaning that ZEND_FE(first_module) will refer to a C function zif_first_module(). If you want to mix macro usage with hand-coded entries (not a good practice), keep this in mind. Tip: Compilation errors that refer to functions named zif_*() relate to functions defined with ZEND_FE. Table 9.2 shows a list of all the macros that you can use to define functions. Obrßzek 31-3. Table 9.2. Macros for Defining Functions
Note: You can't use ZEND_FE in conjunction with PHP_FUNCTION, or PHP_FE in conjunction with ZEND_FUNCTION. However, it's perfectly legal to mix ZEND_FE and ZEND_FUNCTION with PHP_FE and PHP_FUNCTION when staying with the same macro set for each function to be declared. But mixing is not recommended; instead, you're advised to use the ZEND_* macros only. | ||||||||||||||||||||||||
|