Greencard, GHC and FFI.
Mike Thomas
mthomas@gil.com.au
Sun, 18 Mar 2001 08:30:40 +1000
Hi again.
> So, when using GC's FFI backend, it generates two source files for you
> (and some header files) - in your case, GCTest.hs and GCTest_stub.c.
> To achieve linker happiness, you need to compile up the latter and include
> it on the link line *and* drop StdDIS.o from that link line.
Thanks for that - I've achieved linker happiness.
FYI, I notice that the GCTest stub file has a do..while(0), which I suppose
should be optimised away by GCC, but still makes the code less
palatable:
--------------------------------------------------------
/* Auto generated GreenCard 2 code for FFI */
double prim_my_sin(double arg1)
{ double res1;
do { res1=sin(arg1);
return((double)(res1));} while(0);
}
--------------------------------------------------------
Cheers
Mike Thomas