Help in calling Haskell from C

Mark Conway Wirt mark@ArsConcero.org
Thu, 11 Oct 2001 20:48:28 -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.

Now that 5.02 is out, I was able to get this to work with hdirect 0.18.
However, there was a slight glitch.

The sample code contained the following:

       extern void* __init_MathLibProxy;

and

      startupHaskell(argc,argv,&__init_MathLibProxy);

When I tried to link the code, __init_MathLibProxy came up
undefined.  In looking though the library produced, __init_MathLibProxy
was in fact missing.  However, there was a
__stginit_MathLibProxy, and when I changed the code to startup
using that symbol, the code worked as it should.

Don't know if I was doing anything wrong, but I though I'd mention
it in case anyone else was having problems.

--Mark