
I have some C code in my Cabal package, consisting of both *.c and *.h files. Obviously, the *.c files get listed in "c-sources". But I'm trying to figure out where to list the *.h files. Right now, I'm not listing them anywhere, and my package compiles just fine. According to the Cabal users guide, there is an "includes" field and an "install-includes" field. The "includes" field seems to only be relevant when compiling via C. And even when compiling via C, wouldn't the include already be picked up when it is part of the foreign declaration, e. g.: foreign import ccall unsafe "tmr_tag_data.h TMR_bytesToHex" c_TMR_bytesToHex :: Ptr Word8 -> Word32 -> CString -> IO () As for the "install-includes" field, I don't think my header files would need to be installed, because they're internal to my package. The package's interface is entirely in Haskell. Should I just put my include files in "extra-source-files", so they get added to the package, but otherwise aren't treated specially? Or should I be using "includes" and/or "install-includes"? Thanks, --Patrick

On 2017-05-30 02:13 PM, Patrick Pelletier wrote:
And even when compiling via C, wouldn't the include already be picked up when it is part of the foreign declaration, e. g.:
foreign import ccall unsafe "tmr_tag_data.h TMR_bytesToHex" c_TMR_bytesToHex :: Ptr Word8 -> Word32 -> CString -> IO ()
No for GHC. https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/ffi-chap.htm...

On 6/2/17 10:01 AM, Albert Y. C. Lai wrote:
https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/ffi-chap.htm...
This also says that "include-files" is ignored. So I'm still sticking by my original assertion, that header files should just go in "extra-source-files". --Patrick
participants (2)
-
Albert Y. C. Lai
-
Patrick Pelletier