In Scurry, I select the CALLCONV on the CPP command line. This might be better if it's the only place you need an #ifdef.
executable scurry
[..]
if os(mingw32)
c-sources: src/C/help-win.c
extra-libraries: Iphlpapi, ws2_32
cc-options: -D MINGW32
cpp-options: -DCALLCONV=stdcall
if os(linux)
build-depends: unix >= 2.3.0.0
c-sources: src/C/help-linux.c
cc-options: -D LINUX
cpp-options: -DCALLCONV=ccall
2009/3/29 Johan Tibell <johan.tibell@gmail.com>:
>This is what we use in Takusen's Database.ODBC.OdbcFunctions.hsc:
> foreign import CALLCONV unsafe "send"
> c_send :: CInt -> Ptr a -> CSize -> CInt -> IO CInt
>
> Compiling results in:
>
> parse error on input `CALLCONV'
#ifdef mingw32_HOST_OS
#let CALLCONV = "stdcall"
#else
#let CALLCONV = "ccall"
#endif
foreign import #{CALLCONV} unsafe "sql.h SQLAllocHandle" sqlAllocHandle ::
SqlHandleType -> Handle -> Ptr Handle -> IO SqlReturn
Alistair
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe