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. http://hackage.haskell.org/packages/archive/Scurry/0.0.3/Scurry.cabal See the OS selection in the executable section: 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 /jve On Mon, Mar 30, 2009 at 4:41 AM, Alistair Bayley <alistair@abayley.org>wrote:
2009/3/29 Johan Tibell <johan.tibell@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 _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe