C main
Simon Marlow
fldrsimonmar@microsoft.com
Thu, 12 Oct 2000 02:07:45 -0700
> Greetings -
>
> Could someone instruct me on (or point me to) the correct ghc
> command line
> for calling haskell from C?
> From the documentation, it seems like "ghc -fglasgow-exts
> -no-hs-main main.c
> foo.hs" should work, but
> that still gives me a multiple definition of "main".
>
> I'm running ghc 4.08.1 on Windows NT.
You can use ghc just like you would use gcc to compile up your C program,
then use ghc again to link the whole program with the Haskell module(s).
The -no-hs-main flag shouldn't be necessary, as far as I can tell. eg.
$ ghc -c main.c
$ ghc -c HaskellStuff.hs
$ ghc main.o HaskellStuff.o
Cheers,
Simon