Topic : The GFA-Basic Compendium
Author : GFA Systemtechnik GmbH
Version : GFABasic.HYP v2.98 (12/31/2023)
Subject : Documentation/Programming
Nodes : 899
Index Size : 28056
HCP-Version : 3
Compiled on : Atari
@charset : atarist
@lang :
@default : Document not found
@help : Help
@options : +g -i -s +z
@width : 75
@hostname : STRNGSRV
@hostname : CAB
@hostname : HIGHWIRE
@hostname : THING
View Ref-FileIn the C routines used so far only C keywords have been used, but no library
routines. If, for example, you wanted to use a printf in one of the C routines,
you would have to link the appropriate routine from the libraries.
This can be done by extending the compiler's library. The following
small program enables you to integrate the Turbo C libraries into the
compiler's library. Your C routines can then contain all the C instructions
from the libraries. The program reads likes this:
OPEN "O",#2,"NEW_LIB"
OPEN "I",#1,"GFA3BLIB"
l%=LOF(#1)
WHILE l%>32000
PRINT #2,INPUT$(32000,#1);
SUB l%,32000
WEND
PRINT #2,INPUT$(l%,#1);
CLOSE #1
@append("TCSTDLIB.LIB")
@append("TCEXTLIB.LIB")
@append("TCGEMLIB.LIB")
@append("TCTOSLIB.LIB")
@append("TCFLTLIB.LIB")
CLOSE #2
'
PROCEDURE append(lib$)
RELSEEK #2,-2
OPEN "I",#1,lib$
l%=LOF(#1)-2
SEEK #1,2
WHILE l%>32000
PRINT #2,INPUT$(32000,#1);
SUB l%,32000
WEND
PRINT #2,INPUT$(l%,#1);
CLOSE #1
RETURN
To use this program, you may have to change the path name of the files. To use
the new library, you will require the appropriate index files (NDX files),
which can be generated with the library manager of the GFA-Assembler, for
instance, or similar programs (DOINDEX).
As soon as both files are created, you can use all instructions from the Turbo
C libraries in the C routines to be linked. You simply need to tell the GFA
BASIC linker that you wish to use the new library and not GFA3BLIB. This is
done with the +lib_name linker option if you are using a DOS shell (in our
example, +NEW_LIB).
The linker may, under certain circumstances, report back that it does not
recognise the variable errno. C compilers do not take this from the libraries
as it is part of the startup code.
One precondition for the trouble-free use of the new library is that the Turbo
C and the GFA3BLIB libraries do not contain any functions which exist under the
same name in both libraries. We do not know of any such function in the present
version of Turbo C.