I have two files!
try1.c
#include <stdio.h>
int affiche(void);
int main(void)
{
printf("toto\n");
affiche();
return 0;
}
try2.c
#include <stdio.h>
int affiche(void)
{
printf("tata\n");
return 0;
}
With gcc, this is correct:
gcc -o try try1. try2.c
With z88dk, I obtain
zcc +zx -o try try1.c try2.c
cp /home/david/z88dk/lib/config//../..//lib/spec_crt0.opt /tmp/tmpXXw3UHJE.opt
cp /tmp/tmpXXw3UHJE.opt /tmp/tmpXXw3UHJE.asm
zcpp -I. -DZ80 -DSPECTRUM -D__SPECTRUM__ -D__SPECTRUM -DSCCZ80 -DSMALL_C -I/home/david/z88dk/lib/config//../..//include try1.c /tmp/tmpXXO32KhH.i
sccz80 -asm=z80asm /tmp/tmpXXO32KhH.i
copt /home/david/z88dk/lib/config//../..//lib/z80rules.2 < /tmp/tmpXXO32KhH.asm > /tmp/tmpXXO32KhH.op1
copt /home/david/z88dk/lib/config//../..//lib/z80rules.1 < /tmp/tmpXXO32KhH.op1 > /tmp/tmpXXO32KhH.opt
z80asm -eopt -ns -Mo -I/home/david/z88dk/lib/config//../..//lib /tmp/tmpXXO32KhH.opt
Error at file '/tmp/tmpXXO32KhH.opt' line 23: symbol '_affiche' not defined
1 errors occurred during assembly
Errors in source file try1.c:
Error at file '/tmp/tmpXXO32KhH.opt' line 23: symbol '_affiche' not defined
^ ---- call _affiche
Impossible to compile two files
sccz80 is creating function prototypes with static linkage by default rather than extern.
Slipping an extern keyword in front of function prototypes will work around the bug:
try1.c
Slipping an extern keyword in front of function prototypes will work around the bug:
try1.c
Code: Select all
#include <stdio.h>
extern int affiche(void);
int main(void)
{
printf("toto\n");
affiche();
return 0;
}
Fixed in the feb 22 build.
An updated windows sccz80.exe file can be downloaded from here before feb 22:
https://drive.google.com/open?id=0B6XhJ ... i01QjRtdE0
An updated windows sccz80.exe file can be downloaded from here before feb 22:
https://drive.google.com/open?id=0B6XhJ ... i01QjRtdE0