
Hello Haskell, what is a best way to bring C constant (defined in header file) into the Haskell source? Haskell project is cabalized and should work with both Win and Unix while the constants are OS-specific. the best way i found at this moment is to use the following scheme: mmap.h: #if defined(mingw32_HOST_OS) || defined(__MINGW32__) || defined(_MSC_VER) .... #else INLINE int const_MAP_FILE( void ) { return MAP_FILE; } #endif mmap.hs: #if defined(mingw32_HOST_OS) || defined(__MINGW32__) || defined(_MSC_VER) .... #else foreign import ccall unsafe "mydefs.h const_MAP_FILE" mAP_FILE :: CInt #endif Second question is how to test whether program compiles under Unix or Windows environment. Posix/Win32 packages availability would be the best criterion but it can't be tested :( -- Best regards, Bulat mailto:Bulat.Ziganshin@gmail.com