Crazy Library Failure

ZX80, ZX 81, ZX Spectrum, TS2068 and other clones
Post Reply
Zetr0
Member
Posts: 60
Joined: Mon Aug 22, 2011 12:38 pm

Crazy Library Failure

Post by Zetr0 »

Hello thre my fello z88dk'ers

I recently managed to get file-handling working very well, then strangely when playing around with the graphics routines I then ended up with an uncompileable error.

Now, I have been plauged by this problem for the last couple of hours and its driving me crazy as I have no idea why its having such fit when it was working fine. so I slapped up a simple hello-word and its still having the same problems -

Test Code

Code: Select all

#include <stdio.h>

void main( void )
{
  printf("hello world");
}
Very simple stuff -


Compile Line

Code: Select all

zcc +zxansi -lp3 -DPLUS3 -lm -create-app program.c >build.txt
All of a sudden for no reason I am recieving this error output

Result

Code: Select all

zcc +zxansi -lp3 -DPLUS3 -lm -create-app program.c 1>build.txt
2 errors occurred during assembly
Key to filenames:
C:\DOCUME~1\Zetr0\Locals~1\Temp\s4fo_.o = program.c
File 'C:\PROGR~1\z88dk\lib\clibs/p3.lib', Module 'FREEHAND', Symbol not defined

Error in expression _HAND_STATUS

File 'C:\PROGR~1\z88dk\lib\clibs/p3.lib', Module 'FREEHAND', Symbol not defined

Error in expression _HAND_STATUS
obviously if I change the "-lp3" to say "-lndos", everything compiles, although theres no +3 disk IO (which my project sorely needs)

I honestly don't know what to do at present.... I have tried uninstalling z88dk and installing it once again and the error is still present - its just very pecular and I could use your help


here is the build log

Code: Select all

        1 file(s) copied.
        1 file(s) copied.
Unrecognised argument: \\
copy C:\PROGRA~1\z88dk\lib\spec_crt0.opt C:\DOCUME~1\Zetr0\LOCALS~1\Temp\s4fo_1.opt
copy C:\DOCUME~1\Zetr0\LOCALS~1\Temp\s4fo_1.opt C:\DOCUME~1\Zetr0\LOCALS~1\Temp\s4fo_1.asm
zcpp -I. -DZ80 -DSMALL_C -DSPECTRUM -D__SPECTRUM__ -DSCCZ80 -DPLUS3 -IC:\PROGRA~1\z88dk\include  program.c C:\DOCUME~1\Zetr0\LOCALS~1\Temp\s4fo_.i
sccz80    -\\  C:\DOCUME~1\Zetr0\LOCALS~1\Temp\s4fo_.i
copt C:\PROGRA~1\z88dk\lib\z80rules.2 < C:\DOCUME~1\Zetr0\LOCALS~1\Temp\s4fo_.asm > C:\DOCUME~1\Zetr0\LOCALS~1\Temp\s4fo_.op1
copt C:\PROGRA~1\z88dk\lib\z80rules.1 < C:\DOCUME~1\Zetr0\LOCALS~1\Temp\s4fo_.op1 > C:\DOCUME~1\Zetr0\LOCALS~1\Temp\s4fo_.opt
z80asm -eopt -ns -Mo -IC:\PROGRA~1\z88dk\lib C:\DOCUME~1\Zetr0\LOCALS~1\Temp\s4fo_.opt
z80asm -a -m -Mo -LC:\PROGRA~1\z88dk\lib\clibs -oa.bin -igen_math  -ip3  -izxan_clib  -iz80_crt0  C:\DOCUME~1\Zetr0\LOCALS~1\Temp\s4fo_1.opt C:\DOCUME~1\Zetr0\LOCALS~1\Temp\s4fo_.o
Thanks for reading
alvin
Well known member
Posts: 1872
Joined: Mon Jul 16, 2007 7:39 pm

Post by alvin »

I believe I know what the problem is. The simple helloworld is not compiling because "hand_status" is never declared. This comes from findhand.c which never gets linked in.

The crt0 contains code to close all open files which I think eventually calls close.c which calls freehand.c which references the variable hand_status. With no use of fopen() or some other function requiring finding a handle, hand_status is not declared.

To fix it, all the global variables probably should be moved to the crt0.
Zetr0
Member
Posts: 60
Joined: Mon Aug 22, 2011 12:38 pm

Post by Zetr0 »

@alvin

My sincere thanks for reading this post,

Some most awesome chummies over at WorldofSpectrum also pointed this fault out, its quite ironic that I discovered this issue because I was being lazing in a bit of code - after testing a couple of file-handling routines, I "/* */" them out to focus on some graphic display code ("within the same program file") however because fopen or flcose was not used - it developed this error.

It wasn't untill much later when I realized I could complile the program with the "-lndos" dummy retainer instead of the "-lp3" library that I suspected somthing like the above had taken place...

I have to admit I really am loving z88dk, sure it has peculiarities, and its some what, seat-of-your-pants coding, but I am truly loving it!
Post Reply