Hi,
I have been trying to build a Cabal package that uses c2hs under mingw and have run into some problems.
1)
c2hs needed its own options because it has to pass a flag to its
invocation of the CPP. I have already submitted this patch. (I also
noticed a request for cppOptions in the Cabal.cabal file, so I added
that)
2) When c2hs generates the
foreign import ccall unsafe "path/to/include.h function" :: Type
it doesn't insert the appropriate number of path separators for windows (
i.e. \\ not \)
I have this patch sitting in my copy of c2hs. But what I did is really ugly:
at around line 567 (process :: FilePath -> FilePath -> CST s ())
I inserted:
> outFName' <- getSwitch outputSB
> -- on windows the path separator needs to be "\\" not "\"
> let outFName = replaceFileSeparator outFName'
where replaceFileSeparator is defined as:
> replaceFileSeparator :: String -> String
> replaceFileSeparator [] = []
> replaceFileSeparator (x:xs)
> | x == '\\' = "\\\\" ++ (replaceFileSeparator xs)
> | otherwise = x : (replaceFileSeparator xs)
this fixes the problem but stinks.
3) when compiling my c2hs generated .hs file, the c2hs generated .h file is not being found.
$ ./Setup.lhs -v build
Reading parameters from D:\Apps\MSYS\1.0\local\src