Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Php Meets Messagepack

6,329 views

Published on

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

Published in: Technology, Sports
  • Be the first to comment

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;               }

×