PHP 4.0 Bug #7474: ext/standard/scanf.c reports strtol/strtoul "undefined reference"
| From: | widman at cardiothink dot com | Date: | Thu, 26 Oct 2000 04:07:37 +0000 |
| Subject: | PHP 4.0 Bug #7474: ext/standard/scanf.c reports strtol/strtoul "undefined reference" | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-36043@lists.php.net to get a copy of this message | ||
From: widman@cardiothink.com
Operating system: SunOs 4.1.4 (!)
PHP version: 4.0.3pl1
PHP Bug Type: Compile Failure
Bug description: ext/standard/scanf.c reports strtol/strtoul "undefined reference"
SunOs 4.1.4 has strtol (at least, the man page for it). And,
ext/mysql/libmysql has a replacement for strtol/strtoul.
But, the "out of the box" compile fails in ext/standard/scanf.c with the complaint:
strtol/strtoul are "undefined references". I tried to cut and paste from the files in
ext/mysql/libmysql but got a zillion compiler errors.
Then, I added the following to the start of scanf.c based on the SunOs man page:
long strtol( char *str, char **ptr, int base );
ulong strtoul( char *str, char **ptr, int base );
The compile succeeded, but complained that these functions had been defined as int implicitly in
./Zend/zend_operators.c. I then changed the added lines to
int strtol( char *str, char **ptr, int base );
int strtoul( char *str, char **ptr, int base );
These lines allowed the file to compile without warnings,
and the rest of the php4 compile proceeded smoothly. I guess I'll just have to see whether I
should have gone through the entire package and defined these functions as long/ulong everywhere
instead of making them "int" in this one file.
I don't know how best to handle this idiosyncracy in the php4 package. I searched everything
in /usr/include for definitions of strtol and strtoul, but couldn't find any files that define
them. Maybe you could include a short .h file with these definitions, or add them to a global file
for those systems that don't define these right.
Thanks for all your hard work! - Larry Widman
--
Edit Bug report at: http://bugs.php.net/?id=7474&edit=1