
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.
hth
--sigbjorn
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.
----- Original Message -----
From: "Mark Conway Wirt"
To:
I've been using hdirect for C <-> Haskell calls, and I've hit a bit of a snag. I'm using ghc 5.00.2 and hdirect 0.17.
I've been able to call Haskell from C easily enough, but I've been unable to go the other way.
I've tried following the directions in the hdirect manual, and tried building the examples in the hdirect distribution. Everything works up until final linking, where I receive undefined references.
The C code should initialize the Haskell run-time, as it include the startup code:
extern void startupHaskell (int argc, char* argv[]); startupHaskell(argc,argv);
I'm compiling via ghc with the following options:
ghc -package hdirect -fglasgow-exts -static -no-hs-main
and the idl is compiled as such:
ihc -s -fhs-to-c --gen-headers -fuse-ints-everywhere --output-h=....
Does hdirect work with ghc 5.00.2? I'm not receiving any errors in the build process, so I think my problems are more related to a lack of documentation, as opposed to a bug. Does anyone have any information (beyond what is in the hdirect documentation) on calling ghc-compiled code from C?
The undefined references I'm getting are:
undefined reference to `__init_Main' undefined reference to `Main_main_closure'
Thanks in advance. I've looked though the mailing list archive and haven't found anything. If this has been answered before I apologize.
--Mark
_______________________________________________ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users