Re: How to compile new PHP runtime function
| From: | Rasmus Lerdorf | Date: | Thu, 14 Dec 2000 06:42:53 +0000 |
| Subject: | Re: How to compile new PHP runtime function | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-41294@lists.php.net to get a copy of this message | ||
> Thank you Rasmus. That document seems to raise more questions than it
> answers (like what are all those ZEND_ macros for?) but it's certainly a
> start. Also, I came across this:
>
> "You shouldn't have to ask what happens if you leave --string-lens out.
> If you have to, it's questionable whether you should be reading this
> document."
>
> Since I have to ask what happens if I leave --string-lens out, should I quit?
Yes, you probably should. If you would spend about 30 seconds to think
about it you should be able to figure it out. And if you can't, then sad
as it may be, you probably should go do something else.
The document says:
--assign-params
--string-lens
By default, function proto 'void foo(string bar)' creates the following:
...
zval **bar;
... (zend_get_parameters_ex() called in the middle...)
convert_to_string_ex(bar);
Specifying both of these options changes the generated code to:
...
zval **bar_arg;
int bar_len;
char *bar = NULL;
... (zend_get_parameters_ex() called in the middle...)
convert_to_string_ex(bar_arg);
bar = Z_STRVAL_PP(bar_arg);
bar_len = Z_STRLEN_PP(bar_arg);
See how the parameters are assigned to variables? Hence --assign-params
And see how the strlen is assigned to the bar_len variable? Hence --string-lens
-Rasmus