Linking to Haskell code from an external program
Simon Marlow
marlowsd at gmail.com
Mon Nov 17 07:28:08 EST 2008
Colin Paul Adams wrote:
> Embarassing - I simply forgot to include Fib.o in the link.
> So it links now (program crashes, but I can try to sort that out).
>
> I'm still intereted in knowing how to automatically get the list of
> required libraries.
>>>>>> "Colin" == Colin Paul Adams <colin at colina.demon.co.uk> writes:
>
> Colin> I am trying to call a Haskell function from an Eiffel
> Colin> program, using C as an intermediary.
>
> Colin> For starters, I compiled and ran a variation of the program
> Colin> shown in
> Colin> http://haskell.org/haskellwiki/Calling_Haskell_from_C, to
> Colin> make sure I had the C-code right.
>
> Colin> I then attempted to move it into Eiffel. I can compile the
> Colin> C code OK, but I'm running into problems with linking.
>
> Colin> I solved most of the problems by adding the -v flag to the
> Colin> call to ghc which I used to link the original (haskell + c
> Colin> only) program, and cut-and-paste the linker options from
> Colin> their into the Eiffel configuration file. This isn't really
> Colin> satisfactory - I would like some automatic way to determine
> Colin> what the flags should be.
The only other way I can think of is to construct the arguments yourself by
querying the package database, e.g. "ghc-pkg field ld-options rts", but
you'll have to combine the information from several different fields of the
packages you use, and basically reproduce what GHC does to construct the ld
command line.
Cheers,
Simon
More information about the Glasgow-haskell-users
mailing list