hsc2hs and #include

Evan Laforge qdunkan at gmail.com
Sat Jul 30 23:10:21 CEST 2011


On Sat, Jul 30, 2011 at 8:32 PM, Edward Z. Yang <ezyang at mit.edu> wrote:
> This is supposed to get defined as a command line argument to the preprocessor,
> see compiler/main/DriverPipeline.hs.  Are you saying you don't see it when you
> run hsc2hs? Maybe someone else is calling a preprocessor but missing some of
> these arguments...

Yes, I don't see it when I run hsc2hs.  I don't see how a define from
ghc is going to make it into the hsc2hs generated C file, since it
just compiles the c file with no special flags.  Looking at the hsc2hs
source, it runs the c compiler with cFlags, which I think ultimately
comes from the flags.  Since it doesn't import anything out of ghc I
don't know how it's supposed to get macros from there either, unless
that was supposed to have gone into some header.

Here's my hsc2hs line:

hsc2hs -v -c g++ --cflag -Wno-invalid-offsetof
-I/Library/Frameworks/GHC.framework/Versions/7.0.3-x86_64/usr/lib/ghc-7.0.3/include
\
		-Ifltk -I. -I/usr/local/src/fltk-dev/fltk-1.3/ -D_THREAD_SAFE
-D_REENTRANT -DMAC_OS_X_VERSION_MAX_ALLOWED=1060
-DMAC_OS_X_VERSION_MIN_REQUIRED=1050  Ui/Style.hsc
Executing: g++ -c Ui/Style_hsc_make.c -o Ui/Style_hsc_make.o
-Wno-invalid-offsetof
-I/Library/Frameworks/GHC.framework/Versions/7.0.3-x86_64/usr/lib/ghc-7.0.3/include
-Ifltk -I. -I/usr/local/src/fltk-dev/fltk-1.3/
Executing: g++ Ui/Style_hsc_make.o -o Ui/Style_hsc_make
Executing: Ui/Style_hsc_make  >Ui/Style.hs

BTW, -Wno-invalid-offsetof was necessary to get the compiler to not
complain about the C generated by the #poke and #peek macros, and with
the latest version of hsc2hs I had to explicitly tell it where the ghc
directory is... I guess it's supposed to get that out of its cabal but
I'm not sure how.



More information about the Glasgow-haskell-users mailing list