[comp.sys.atari.st] GFA BASIC and C

tasayco@phoenix.Princeton.EDU (Maria Tasayco) (11/15/90)

 I received the following message from a person who needs help in
interfacing GFA BASIC with C, and cannot post to the net. If somebody 
can help him please send mail to 21c19@titan.hts.hsa.nl
----------------------------------------------------------------------------
Hi !
I have a problem using C in GFA-basic and since you seem to know quite a lot
of C-language, I mailed you. (We are not allowed to post articles).
The problem is that I have a certain basic-program, which uses a routine
very much, so I have written this routine in C.
(The routine calculates the determinant-value of a matrix).
You can call a C-routine in gfa by the command :
var = C:adress(param1,param2,param3 etc)
where adress is the starting-adress of the C-compiled program.
This command does not seem to work quite well, the c program is not executed
and the interpreter returns with the error "three bombs bus error."
So I made a very simple program just to test the command. The program :

adress=MALLOC(2000)    ! reserve 2kbytes of memory for program
BLOAD "A:\PROGRAM.PRG",adress  ! Load program in reserved memory
result = C:adress()    ! No parameters, execute c program
dummy=MFREE(adress)    ! release reserved memory

The c-source :
#include <stdio.h>

float main()
{
printf("This is a c program");
}

I am using the Turbo-C compiler.
Do you know a solution to this problem ?
If not, would you please be so kind to post the article on comp.sys.atari.st ?

Thanks in advance,
Roland (HTS Alkmaar, The Netherlands)
----------------------------------------------------------------------------
Please send replies to: e21c19@titan.hts.hsa.nl