I'm hacking around with someone else's code. They have several macros defined in a .h file (no code, just macros), and these macros are used in several Haskell files. What I'm missing is the step which allows this compilation. When I try to compile the Haskell file, I just get errors on the missing/undefined macros. Is there a GHC option that will use macros defined in a header file? I'm trying to do the same with GHCi.
I did attempt to just rename the .h file to .hs and import it in the files that use the macros, but I am apparently not allowed to export macros (and they are not exported automatically).
How can I use these macros when compiling with GHC(i)?
#include foo.hline to the haskell file. The C preprocessor will expand the macros for you.-DMY_MACRO=3to define a global macro, why can't I make the entire header file a global macro?