[C2hs] Re: [Haskell-cafe] more problems with c2hs

Duncan Coutts duncan.coutts at worc.ox.ac.uk
Thu Apr 12 20:04:04 EDT 2007


On Fri, 2007-04-13 at 09:49 +1000, Ruben Zilibowitz wrote:
> Thanks for pointing to the appropriate mailing list. This is what  
> appears to be happening.
> file.chs has a line: #include "file.h"
> After running:
> c2hs file.chs
> file.h gets modified so that it contains just:
> #include "file.h"
> 
> So I lose the contents of file.h every time I run c2hs!

Yes, this file is generated by c2hs from the things you put in the .chs
file (like #include and other cpp stuff, #if and the like).

So you can't modify that .h file yourself. Also, you cannot #include
"file.h" inside "file.chs" because that'll generate a "file.h" file that
recursively #includes itself!

Personally, I think it's very bad behaviour that the file is called the
same as the .chs file but with a .h extension, since this is exactly the
name of a file that many people will want to include. I intend to change
it to use file.chs.h or something similar that will not clash. (Also I'd
like to not generate any .chs.h file in the common case of just
#including a single .h file.)

Duncan



More information about the C2hs mailing list