[solved] Re: [Haskell-cafe] c2hs and cabal?

Duncan Coutts duncan.coutts at worc.ox.ac.uk
Tue Nov 28 22:38:24 EST 2006


On Tue, 2006-11-28 at 17:24 +0000, Magnus Therning wrote:
> On Tue, Nov 28, 2006 at 12:00:50 +0000, Magnus Therning wrote:
> [..]
> >Can't really see anything obviously bogus about the following:
> >
> >  % cat Foo.chs
> >  module Foo where
> >
> >  #include "foo.h"
> >
> >  fooOne i = {# call foo1 #} i
> 
> I solved my problem, but thought I'd send a mail to the list for anyone
> who's struggling as much as me (if that's even possible).
> 
> The problem was that GHC requires a commandline argument telling it to
> deal with FFI.  Including the following in Foo.chs resulted in
> successful compilation:
> 
>  {-# OPTIONS_GHC -fffi #-}

Or the simpler way is to include in your .cabal file:

extensions: ForeignFunctionInterface

That then applies to every module in the lib and has the advantage of
being portable between compilers.

Duncan



More information about the Haskell-Cafe mailing list