newlib 1.10.0 vs Linux string.h difference
Joel Sherrill <joel@OARcorp.com>
joel.sherrill@OARcorp.com
Thu Aug 22 10:07:00 GMT 2002
Hi,
Eric Norum ran across a problem some libstdc++-v3 code in gcc 3.2
which compiles native but doesn't with newlib because of a minor
difference in the two string.h implementations. I don't know whether
this is a bug in newlib or not and wanted comments:
The file:
#include <string.h>
int f(char *c1) {
char *c;
c=strdup(c1);
}
These are all with GCC 3.2 on RedHat 7.3.
bash-2.05$ /opt/gcc-3.2/bin/gcc -c j.c
bash-2.05$ /opt/gcc-3.2/bin/gcc -ansi -c j.c
bash-2.05$ mips-rtems-gcc j.cc -c
bash-2.05$ mips-rtems-gcc -ansi j.cc -c
j.cc: In function `int f(char*)':
j.cc:5: `strdup' undeclared (first use this function)
j.cc:5: (Each undeclared identifier is reported only once for each
function it
appears in.)
Notice that when you turn on -ansi, strdup() no longer has
a prototype from newlib because it is wrapped in a __STRICT_ANSI__
conditional.
Any suggestions on how to address this.
--
Joel Sherrill, Ph.D. Director of Research & Development
joel@OARcorp.com On-Line Applications Research
Ask me about RTEMS: a free RTOS Huntsville AL 35805
Support Available (256) 722-9985
More information about the Newlib
mailing list