[Haskell-cafe] Cabal, GHC, FFI and Visual Studio on Windows

Duncan Coutts duncan.coutts at worc.ox.ac.uk
Sat Feb 2 12:45:02 EST 2008


On Sat, 2008-02-02 at 18:15 +0100, Felix Martini wrote:
> Magnus Therning wrote:
> > Is it possible to get Cabal to use 'cl' (Microsoft's C/C++ compiler
> > shipped with Visual Studio Express)?
> 
> Duncan Coutts wrote:
> > The problem is to get GHC to use 'cl'. That's a longer term project that
> > GHC HQ are interested in. There's something about it on the GHC dev wiki
> > I think. Don't hold your breath.
> 
> When using the native code generator only foreign C code must be
> compiled with a C compiler. Presently Cabal passes C sources that are
> listed in the 'c-sources' field of a cabal file to GHC. It would be
> nice to have a Cabal field to specify the compiler for C sources, say
> 'c-sources-compiler: msvc'. The default would still be gcc, but with a
> Cabal flag the user would be able to change that to e.g. Sun's C
> compiler.

It would be reasonable to use the system C compiler rather than ghc,
however we will have to do more work to find what extra include dirs get
used and have Cabal pass those.

Currently we pass the -package flags to ghc which ghc uses to look up
what include dirs those packages add, and then it calls the C compiler
with those extra include dirs. Cabal would have to do that itself.

Duncan



More information about the Haskell-Cafe mailing list