[Haskell-cafe] Cabal files on Windows

Duncan Coutts duncan.coutts at worc.ox.ac.uk
Fri Aug 1 09:39:51 EDT 2008

On Sun, 2008-07-27 at 21:01 -0500, John Lato wrote:

> > Use Haskell String syntax for paths that contain spaces:
> >
> > include-dirs:  "C:\\Program Files\\program\\include"
> Hi Duncan,
> Thanks, this worked (mostly).  Although I had to change the line to
> include-dirs: "\"C:\\Program Files\\program\\include\""
> so that the path would be passed properly to cpp through c2hs.

Thanks for for filing the ticket John.


Turns out Cabal is doing it right and it's c2hs that we need to fix.
Shouldn't be too hard. Just need to change the way c2hs invokes cpp in

    let cmd  = unwords [cpp, cppOpts, newHeaderFile, ">" ++ preprocFile]
    tracePreproc cmd
    exitCode <- liftIO $ system cmd

to something like:

    let args = cppOpts ++ [newHeaderFile]
    tracePreproc (unwords (cmd : args))
    exitCode <- liftIO $ do
      preprocHnd <- openFile WriteMode preprocFile
      process <- runProcess cpp args
                   Nothing Nothing 
                   Nothing (Just preprocHnd) Nothing
      waitForProcess process

Try that, tell me if it works and we can add the patch to the c2hs repo.


More information about the Haskell-Cafe mailing list