Help in calling Haskell from C
Sigbjorn Finne
sof@galconn.com
Wed, 15 Aug 2001 00:22:32 -0700
"Mark Conway Wirt" <mark@intrepid.net> writes:
> 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,
> though:
>
> [mark@elvis server]$ ghc -package hdirect -fglasgow-exts -static
> -no-hs-main -i../../lib -L../../lib
> -lhdirect -o tst tst.o libHStst.a
> /usr/local/ghc-5.00.2/lib/ghc-5.00.2/libHSstd.a(PrelMain__1.o):
> In function `__init_PrelMain':
....
It could be that ghc-5.00.2 doesn't include the -no-hs-main fix I committed
sometime ago. If you add -v to the final link line and see an occurrence of
PrelMain_mainIO_closure in the invocation of the linker, then that's the
case
& you're out of luck, I'm afraid. (==> you need to get hold of a CVS repo
build and/or wait for 5.02).
> 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
> directly.
>
It's high time that I bring out a new release, I think. You don't need to
compile all of fptools though, the following steps should get you close:
foo$ autoconf
foo$ ./configure <and possibly some options>
foo$ cd glafp-utils && make
foo$ cd hdirect
foo$ make boot
foo$ cd src; make all
foo$ cd lib; make all
--sigbjorn