I have checked several extensions of laruence, all of which are new branches to write php7 extensions; while swoole extensions use a php7-swapper.h for packaging, however, the php kernel used in it is relatively easy to use macros for operations. For example, the php5 extension is defined as below: {generation... I have checked several extensions of laruence, all of which are new branches to write extensions of PHP 7;
The swoole extension, but uses a php7-swapper.h to wrap, but it uses the php kernel inside something relatively easy to use macro to operate.
For example, the php5 extension is defined as follows:
Typedef struct _ test_obj {zend_object std; // put it in the header my_test_struct * my; int count;} test_obj;
According to the PHP 7 extension improvement suggestions, the struct needs to be modified:
Typedef struct _ test_obj {my_test_struct * my; int count; zend_object std; // put it at the end} test_obj;
And so on.Macro
It will make the code look ugly, but if it is not like this, it will take a lot of trouble to modify two pieces of code each time if it is divided into two branches for development.
I don't know if you have any good ideas. please enlighten me. thank you!
Reply content:
I have checked several extensions of laruence. they all pull new branches to write extensions of PHP 7;
The swoole extension, but uses a php7-swapper.h to wrap, but it uses the php kernel inside something relatively easy to use macro to operate.
For example, the php5 extension is defined as follows:
Typedef struct _ test_obj {zend_object std; // put it in the header my_test_struct * my; int count;} test_obj;
According to the PHP 7 extension improvement suggestions, the struct needs to be modified:
Typedef struct _ test_obj {my_test_struct * my; int count; zend_object std; // put it at the end} test_obj;
And so on.Macro
It will make the code look ugly, but if it is not like this, it will take a lot of trouble to modify two pieces of code each time if it is divided into two branches for development.
I don't know if you have any good ideas. please enlighten me. thank you!
The best way for user experience is to use a macro, so that users do not have to select a version. Of course, the disadvantage of this writing is that the two pieces of code will be mixed. after all, PHP7 has made great changes to the infrastructure. although most of the macros in PHP7 still follow the old version, they apply for variables on the stack, some of the variables related to the reference mechanism and other commonly used macros have changed. Therefore, the challenge of merging and writing a piece of data is quite large. If you are in trouble, just write separately like laruence. At present, most extensions are also written in separate modes first, and then merged together when they are more mature.
@ Thank you very much. now, please write separately. Wait Until PHP 7 is completely stable.