[Haskell-cafe] Re: FFI documentation?
Mauricio
briqueabraque at yahoo.com
Mon Nov 10 11:59:06 EST 2008
> Where do I find the documentation for the FFI for GHC? I've read the
> FFI report, the GHC user guide and scoured haskell.org but they all
> gloss over what commands you actually need to give GHC and how to give
> them. "foreign import blah blah" just gives me undefined references.
One well documented and compiler independent way to do that is to use
Cabal packages:
http://www.haskell.org/ghc/docs/latest/html/Cabal/authors.html
as used on Hackage:
http://hackage.haskell.org
If you have never done that, you will take some time to understand the
role of the setup file (which in your case will problably be something
like: import Distribution.Simple; main=defaultMain) and the details of
.cabal files. (The problem you are concerned with is detailed in 3.1.4:
Build Information. You'll see you can also list C files to be compiled
with your code, and if you are using some library that implements the
pkg-config standard then everything is really, really easy. I advise
you to also understand well how 'build-depends' works and how to list
language features out of Haskell 98 — in your situation, at least
'extensions: ForeignFunctionInterface'.)
Best,
Maurício
More information about the Haskell-Cafe
mailing list