Re: cc65 printf substitions failing?

From: groepaz_at_gmx.net
Date: Fri, 14 May 2021 21:35:46 +0200
Message-ID: <2491863.vYhyI6sBWr_at_rakete>
Am Freitag, 14. Mai 2021, 21:28:13 CEST schrieb afachat_at_gmx.de:
> Hi there,
>
> I am trying to build and run a small program for the PET using cc65.
>
> However, this line gives me woes:
>
> 	cprintf("Hello (%d)!\n\r", strlen(s->name));
>
> The only thing it prints is "Hello ()!", so it seems no format substitution
> takes place, even though the man page says all formats from printf are
> supported.
>
> It's actually from a uIP 1.0 distribution and built like:
>
> 	cc65 -g -I../uip -I.  -I../apps/hello-world ../apps/hello-world/
> hello-world.c -o obj/hello-world.s
> 	ca65   -o obj/hello-world.o obj/hello-world.s
> 	ar65 a apps.a obj/hello-world.o
> 	ld65 -t pet obj/main.o obj/clock-arch.o obj/enceth.o apps.a uip.a /
> usr/local/share/cc65/lib/pet.lib -o uip
>
> I also tried using %s instead of %d, but this also does not substitute.
>
> Any ideas?

It should work. Try giving -t to each step, not just the linker. My guess
would be that somehow the character encoding isnt the same in your program and
the library containing printf.

That said, try in a testprogram using

cl65 -t pet -o main.prg main.c

--

http://hitmen.eu                 http://ar.pokefinder.org
http://vice-emu.sourceforge.net  http://magicdisk.untergrund.net

Freedom of the press belongs to those who own one.
<A. J. Leibling>
Received on 2021-05-14 22:02:02

Archive generated by hypermail 2.3.0.