Help in calling Haskell from C

Mark Conway Wirt
Tue, 14 Aug 2001 15:28:29 -0400

On Tue, Aug 14, 2001 at 11:28:57AM -0700, Sigbjorn Finne wrote:
> Hi,
> the 0.17 documentation (and examples) wasn't updated to cover
> the extra argument that startupHaskell() now takes, I'm afraid.
> Attached is a version of tst.c from examples/server/ which shows
> you how to now use startupHaskell() from C.

Thanks for sending this.  I'm still getting the undefined errors,

[mark@elvis server]$ ghc -package hdirect -fglasgow-exts -static 
   -no-hs-main -i../../lib     -L../../lib 
   -lhdirect -o tst tst.o libHStst.a
   In function `__init_PrelMain':
   PrelMain__1.o(.text+0x20): undefined reference to `__init_Main'
   In function `PrelMain_c_srt':
   PrelMain__2.o(.text+0x4): undefined reference to `Main_main_closure'
  In function `PrelMain_c_fast1':
  PrelMain__2.o(.text+0x56): undefined reference to `Main_main_closure'

I'll play around a bit with it to see if I can make them go away.

> btw, if you experience GHC5 compatibility problems with
> HDirect-generated code, checking out a copy of the HDirect sources
> from the CVS repository is a good idea. And if that doesn't clear
> up  the problems you're having either, then please let me know & I'll
> try to sort it out.

I'll try that, but I'm having problems getting the code to compile, without
compiling everything.  I've grabbed both fpconfig and hdirect, and there
is no configure script to set up the fptools directory.  At this point
I can't really recompile the whole chain, as it takes about two days
on my computer, and I don't have sufficient disk space.  I'll see if I
can get the configure script somewhere and try to compile hdirect

Thanks again.