newbie question nr 2: compile error when using php_stream_get_line

php.internals

Arnold Daniels

19 years ago
Hi, I've got another newbie question. My .ini parser now works correctly when parsing a string (thanks to help of Matt Wilmas). With the same function I want to be able to parse content of a stream. I looked at fgets to see how to read a line from a stream. Unfortunately when I call php_stream_get_line. I get the following error: /root/php-5.1.6/ext/qconf/qconf_common.c: In function `qconf_readline_stream': /root/php-5.1.6/ext/qconf/qconf_common.c:42: error: `tsrm_ls' undeclared (first use in this function) /root/php-5.1.6/ext/qconf/qconf_common.c:42: error: (Each undeclared identifier is reported only once /root/php-5.1.6/ext/qconf/qconf_common.c:42: error: for each function it appears in.) make: *** [qconf_common.lo] Error 1 Googling the error returns lot's of websites, be I couldn't make out a real solution. This is the function: /** * Read a line out of a stream. */ char *qconf_readline_stream(zval *in, char **c) { char *line; php_stream *stream; size_t line_len = 0; PHP_STREAM_TO_ZVAL(stream, in); line = php_stream_get_line(stream, NULL, 0, &line_len); if (line != NULL) *(line + line_len) = (char)0; /* make the line into a null terminated string to use string functions link sscan */ return line; } Thanks a lot, Arnold

Johannes Schlueter

19 years ago
Hi, errors complaining about something related to tsrm_ls mean that you're building a thread-safe PHP and forgot some TSRMLS[_...] macros. See for example http://blog.libssh2.org/index.php?/archives/22-What-the-heck-is-TSRMLS_CC-anyway.html for more about these macros. This should help you, but the book from Sara, mentioned in that article, is really worth buying (and being read) if you tend to do some more PHP extending stuff. johannes On Fri, 2006-11-10 at 21:03 +0100, Arnold Daniels wrote: