First, by default, C + + is using. cpp as the extension, and PHP is written in C, so you must use C + + to provide the specified symbol extern "C" for the exchange to solve the problem, the following two parts of the statement must be included:
extern "C" {
#include "Php.h"
#include "php_ini.h"
#include "ext/standard/info.h"
...//other C header files
}
And
extern "C" {
#ifdef Compile_dl_myext
Zend_get_module (Myext)
#endif
}
Second, the STL template definition is not included in the C connection Exchange specifier, and PHP needs to math.h this header file, so the compile time will produce MATH.H (514) Error c2894:templates cannot is declared to has ' C ' linkage error message, to solve this problem, you need to add the following code before your CPP file header, which is the extern "C" connector:
#ifdef WIN32
#include
#endif
Three, same as C, must first declare all function prototypes in the header file, such as: php_myext.h), if the header file is not used, it must be in the CPP file (such as: Ext.cpp) Zend All function prototypes are declared between the functions structure, that is, before the following code:
Function_entry myext_functions[] = {
Php_fe (confirm_myext_compiled, NULL)/* For testing, remove later. */
{null, NULL, NULL}
};
http://www.bkjia.com/phpjc/589781.html www.bkjia.com true http://www.bkjia.com/phpjc/589781.html techarticle A, by default, C + + is using. cpp as the extension, and PHP is written in C, so you must use C + + Provides a C connection to swap the specified symbol extern "C" To resolve this problem, the following two parts ...