php7的文档中有这样的描述:
Both mistakes might cause memory corruptions and segfaults:
1)
char *str;
long str_len; 
zend_parse_parameters(ZEND_NUM_ARGS(), "s", &str, &str_len) 2)
int num; 
zend_parse_parameters(ZEND_NUM_ARGS(), "l", &num)
上面的例子应该改成:
int str_len; ==> size_t str_len;
这样上述例子在php7下才能正常运行。
就这样开始了第一个扩展程序。

关于zend_parse_parameters这个函数的,以下的官方文档内容有介绍,读着很抽象,结合一两个例子就明白了这个取参数的函数的定义:

Type specifiers
---------------
The following list shows the type specifier, its meaning and the parameter 
types that need to be passed by address. All passed parameters are set
if the PHP parameter is non optional and untouched if optional and the 
parameter is not present. The only exception is O where the zend_class_entry*
has to be provided on input and is used to verify the PHP parameter is an 
instance of that class. a - array (zval*)
A - array or object (zval*)
b - boolean (zend_bool)
C - class (zend_class_entry*)
d - double (double)
f - function or array containing php method call info (returned as 
zend_fcall_info and zend_fcall_info_cache)
h - array (returned as HashTable*)
H - array or HASH_OF(object) (returned as HashTable*)
l - long (zend_long)
L - long, limits out-of-range numbers to LONG_MAX/LONG_MIN (zend_long, ZEND_LONG_MAX/ZEND_LONG_MIN)
o - object of any type (zval*)
O - object of specific type given by class entry (zval*, zend_class_entry)
p - valid path (string without null bytes in the middle) and its length (char*, size_t)
P - valid path (string without null bytes in the middle) as zend_string (zend_string*)
r - resource (zval*)
s - string (with possible null bytes) and its length (char*, size_t)
S - string (with possible null bytes) as zend_string (zend_string*)
z - the actual zval (zval*)
* - variable arguments list (0 or more)
+ - variable arguments list (1 or more) The following characters also have a meaning in the specifier string:
| - indicates that the remaining parameters are optional, they
should be initialized to default values by the extension since they
will not be touched by the parsing function if they are not
passed to it.
/ - use SEPARATE_ZVAL_IF_NOT_REF() on the parameter it follows
! - the parameter it follows can be of specified type or NULL. If NULL is
passed and the output for such type is a pointer, then the output
pointer is set to a native NULL pointer.
For 'b', 'l' and 'd', an extra argument of type zend_bool* must be
passed after the corresponding bool*, zend_long* or double* arguments,
respectively. A non-zero value will be written to the zend_bool if a
PHP NULL is passed.

最新文章

  1. CentOS 7 64位的安装流程
  2. Javascript同源策略对context.getImageData的影响
  3. Tech Stuff - Mobile Browser ID (User-Agent) Strings
  4. Oracle 触发器在日志管理开发中的应用
  5. javaweb 乱码总结
  6. Swift - 使用UIView给页面添加4×4方格
  7. executeBatch()相关操作汇总
  8. 前端开发【第3篇:JavaScript序】
  9. 20162317袁逸灏 第八周实验报告:实验二 Java面向对象程序设计
  10. hdu 5534(dp)
  11. [基础]Android 应用的启动
  12. 程序设计与算法(一)C语言程序设计CAP之字符串
  13. Codeforce 886 Технокубок 2018 - Отборочный Раунд 3 C. Petya and Catacombs(结论题)
  14. Confluence 6 配置快捷链接
  15. [转][C#]压缩解压
  16. leetcode — remove-element
  17. TlistView基本使用
  18. linux:查询软件是否安装以及删除
  19. java -D 参数功能解析
  20. uva--242(邮资问题 dp)

热门文章

  1. arm-linux-gcc 的使用
  2. 使用当前平台的 gcc 编译内核头文件
  3. iloc,loc,ix,df[]
  4. Android开发 多媒体提取器MediaExtractor详解_将一个视频文件分离视频与音频
  5. JAVA数据结构之哈希表
  6. jmeter遇到的问题:java.net.ConnectException: Connection refused: connect
  7. [JZOJ3424] 【NOIP2013模拟】粉刷匠
  8. JSON 单例类
  9. C++ 贪吃蛇二维
  10. demjson处理json数据