Hi,<br><br>I have been trying to build a Cabal package that uses c2hs under mingw and have run into some problems.<br><br>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)<br><br>2) When c2hs generates the <br> foreign import ccall unsafe "path/to/include.h function" :: Type<br> it doesn't insert the appropriate number of path separators for windows (
i.e. \\ not \)<br> I have this patch sitting in my copy of c2hs. But what I did is really ugly:<br> at around line 567 (process :: FilePath -> FilePath -> CST s ())<br> I inserted:<br> > outFName' <- getSwitch outputSB
<br> > -- on windows the path separator needs to be "\\" not "\"<br> > let outFName = replaceFileSeparator outFName'<br><br> where replaceFileSeparator is defined as:<br> > replaceFileSeparator :: String -> String
<br> > replaceFileSeparator [] = []<br> > replaceFileSeparator (x:xs) <br> > | x == '\\' = "\\\\" ++ (replaceFileSeparator xs)<br> > | otherwise = x : (replaceFileSeparator xs)
<br><br> this fixes the problem but stinks.<br><br>3) when compiling my c2hs generated .hs file, the c2hs generated .h file is not being found.<br><br>$ ./Setup.lhs -v build<br>Reading parameters from D:\Apps\MSYS\1.0\local\src
<div id="mb_0">\mingw-c2hs-cabal-test\cabal-root\mingw-
c2hs-cabal-test.buildinfo<br>Preprocessing library Mingw-c2hs-cabal-test-0.0.1...<br>D:\Apps\MSYS\1.0\local\bin\c2hs.exe
-C -D__GLASGOW_HASKELL__=606 -C -I..\include --cppopts=-I../include
--include=src -o src\Cabal\MingwTest.hs src\Cabal\MingwTest.chs
<br>D:\Apps\MSYS\1.0\local\bin\c2hs.exe -C
-D__GLASGOW_HASKELL__=606 -C -I..\include --cppopts=-I../include
--include=src -o src\Cabal\MingwTest2.hs src\Cabal\MingwTest2.chs<br>Building Mingw-c2hs-cabal-test-0.0.1...<br>d:\Apps\ghc\ghc-
6.6\bin\ghc.exe -package-name Mingw-c2hs-cabal-test-0.0.1 --make
-hide-all-packages -i -idist\build\autogen -i. -isrc -I..\include
-#include "test.h" -odir dist\build -hidir dist\build -package base-2.0
-O -package haskell98 -fglasgow-exts -fffi Cabal.MingwTest
Cabal.MingwTest2 C2HS<br>[1 of 3] Compiling C2HS ( src/C2HS.hs, dist\build/C2HS.o )<br>[2 of 3] Compiling Cabal.MingwTest ( src/Cabal/MingwTest.hs, dist\build/Cabal/MingwTest.o )<br>C:\DOCUME~1\vivian\LOCALS~1\Temp\ghc31772_0\ghc31772_0.hc:6:33: src\Cabal\MingwTest.h: No such file or directory
<br><br>I have attached a set of files that will generate the errors I have mentioned on mingw.<br><br>Cheers,<br><br>Vivian</div>