Php Meets Messagepack

6,229 views

Published on

phpのエクステンションを作ろう

Published in: Technology, Sports
0 Comments
3 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
6,229
On SlideShare
0
From Embeds
0
Number of Embeds
3,401
Actions
Shares
0
Downloads
17
Comments
0
Likes
3
Embeds 0
No embeds

No notes for slide

Php Meets Messagepack

  1. 1. typedef union _zvalue_value { long lval; /* long value */ double dval; /* double value */ struct { char *val; int len; } str; HashTable *ht; /* hash table value */ zend_object obj; } zvalue_value; struct _zval_struct { zvalue_value value; /* value */ zend_uchar type; /* active type */ zend_uchar is_ref; zend_ushort refcount; };
  2. 2. PHP_FUNCTION(example2) { char *str; int str_len; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) { return; } printf("%sn", str); }
  3. 3. #define RETURN_LONG(l) { RETVAL_LONG(l); return; } #define RETVAL_LONG(l) ZVAL_LONG(return_value, l) #define ZVAL_LONG(z, l) {                         Z_TYPE_P(z) = IS_LONG;                   Z_LVAL_P(z) = l;               }

×