fgetc_cons and stdio

ZX80, ZX 81, ZX Spectrum, TS2068 and other clones
Post Reply
stefano
Well known member
Posts: 2137
Joined: Mon Jul 16, 2007 7:39 pm

fgetc_cons and stdio

Post by stefano »

My local z88dk copy is not totally in sync, but I don't seem to have seen changes on stdio recently.
So:


https://www.seasip.info/ZX/Haunted/haunted.c

$ zcc +zx -lndos haunted.c
Error at module 'haunted_c': symbol '_fgetc_cons' already defined in module 'haunted_c'
Errors in source file c:/z88dk/\lib\target\zx\classic\spec_crt0.asm:
Error at module 'haunted_c': symbol '_fgetc_cons' already defined in module 'haunted_c'
User avatar
dom
Well known member
Posts: 2076
Joined: Sun Jul 15, 2007 10:01 pm

Re: fgetc_cons and stdio

Post by dom »

In general, the linkage is tested on every build for every target using the feature test: https://github.com/z88dk/z88dk/blob/mas ... /feature.c

So, this one must be something to do with the source. It's a fun one, in stdio.h we've got this:

Code: Select all

#define getkey() fgetc_cons()
And haunted.c has this:

Code: Select all

void getkey()
{
        printf("Press RETURN to continue  ");
        fflush(stdout);
        getchar();
}
Which courtesy of that macro is rewritten as void fgetc_cons() and you end up with duplicate label.
stefano
Well known member
Posts: 2137
Joined: Mon Jul 16, 2007 7:39 pm

Re: fgetc_cons and stdio

Post by stefano »

uh, thanks! I wasn't able to spot it :/
Post Reply