#12290 - oX - Thu Nov 06, 2003 10:20 pm
Hi everybody, i'm newbie in gba programming so please don't be too hard with me ;)
I've a problem with this code :
Code: |
void FONT::DisplayGenString(const char * format, ...)
{
va_list par;
va_start(par,format);
char temp[1024];
vsprintf(temp,format,par);
va_end(par);
DisplayString((char*)&temp, (u8)0, 16);
}
|
It compiles but doesn't link and i've these errors :
C:\GBA\devkitadv\arm-agb-elf\lib\interwork/libc.a(vfprintf.o): In function `_vfprintf_r':
../../../../../../gcc-3.0.2/newlib/libc/stdio/vfprintf.c:847: undefined reference to `__eqdf2'
../../../../../../gcc-3.0.2/newlib/libc/stdio/vfprintf.c:877: undefined reference to `__nedf2'
etc...
Any ideas why it doesn't link ??
I'm using classic makefile by Benjamin D. Hale
crt0.s and LinkScript of Jeff Frohwein
Thanks a lot for any help !!
oX
#12297 - tepples - Fri Nov 07, 2003 12:42 am
For one thing, you're supposed to use vsiprintf(), a Newlib extension which is identical to vsprintf() except that it does not handle floating-point numbers and thus does not bring in the software floating-point library, instead of vsprintf(), which does bring in the software floating-point library.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#12298 - yaustar - Fri Nov 07, 2003 1:06 am
Excuse my ignorance but what is the code / functions for?
From what I can see, it looks like it displays text to the screen..
_________________
[Blog] [Portfolio]
#12306 - oX - Fri Nov 07, 2003 12:08 pm
yes indeed
in fact i can already display font
so i would compute a string than i could send to the display
isn't it possible ??
tks
oX
#12307 - tepples - Fri Nov 07, 2003 5:24 pm
Have you tried replacing vsprintf() with vsiprintf() yet?
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#12311 - oX - Fri Nov 07, 2003 9:02 pm
yep i've just tried this but it doesn't compile :
vsiprintf' undeclared (first use this function)
i've searched this string in all files of my gba directory and i've found nothing !!!!
with vsprintf it doesn't link...
i don't understand..
#12318 - tepples - Fri Nov 07, 2003 11:37 pm
You indeed have found a bug in newlib, whose stdio.h contains integer versions only of printf, fprintf, sprintf, and vfprintf, but no va_list form of sprintf. Care to report this bug to Red Hat?
To work around this bug, write your own vsiprintf by downloading the newlib source code, looking at vsprintf.c, and replacing each call to vfprintf with a call to vfiprintf.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#12349 - oX - Sat Nov 08, 2003 4:38 pm
in libiberty/vsprintf.c i've this code for vsprintf :
Code: |
int
vsprintf (buf, format, ap)
char *buf;
const char *format;
va_list ap;
{
FILE b;
int ret;
#ifdef VMS
b->_flag = _IOWRT|_IOSTRG;
b->_ptr = buf;
b->_cnt = 12000;
#else
b._flag = _IOWRT|_IOSTRG;
b._ptr = buf;
b._cnt = 12000;
#endif
ret = _doprnt(format, ap, &b);
putc('\0', &b);
return ret;
}
|
no call to vfprintf !!
so i suppose i don't have the good version of vsprintf !?
where could i found this ?
or could someone post it here ?
tks a lot
oX
#12351 - tepples - Sat Nov 08, 2003 6:26 pm
oX wrote: |
in libiberty/vsprintf.c i've this code for vsprintf :
[snip]
no call to vfprintf !!
so i suppose i don't have the good version of vsprintf !? |
I said Red Hat Newlib (i.e. GCC's C library), not GNU Libiberty. I mentioned that the iprintf family is a Newlib extension. You can download the latest Newlib source code here.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.