How to have c2hs working with ghc CPP extension?

48 Views Asked by At

I have some #IF and #ENDIF in .hs. If I just rename the file to .chs, the #IF and #ENDIF are just moved to .h generated by c2hs instead of the .hs generated by c2hs.

I did not see this mentioned in https://github.com/haskell/c2hs/wiki/Implementation-of-Haskell-Binding-Modules .

Any idea how? Thanks.

1

There are 1 best solutions below

0
On

I'm not positive this is the case since I've never had that problem before, but try lowercase preprocessor commands (#if, #endif). Those are what I use, and c2hs processes them without any issue -- even without {-# LANGUAGE CPP #-}!