[Haskell-cafe] Problem using #define in .hsc files

Alistair Bayley alistair at abayley.org
Mon Mar 30 04:41:20 EDT 2009


2009/3/29 Johan Tibell <johan.tibell at gmail.com>:
>
> foreign import CALLCONV unsafe "send"
>    c_send :: CInt -> Ptr a -> CSize -> CInt -> IO CInt
>
> Compiling results in:
>
> parse error on input `CALLCONV'


This is what we use in Takusen's Database.ODBC.OdbcFunctions.hsc:

#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


More information about the Haskell-Cafe mailing list