How to pass a string from Haskell to C?
All I want to do is pass a plain-text string from Haskell to C. However, it says that [Char] is an unacceptable return type. I can't find anywhere why they think it is, nor what acceptable return types are. I'm trying to make a very simple OS image that I can boot with Qemu. Does anyone know how to do this? Thanks. {-# LANGUAGE ForeignFunctionInterface #-} module Hello where import Foreign import Foreign.C.String import Foreign.C.Types hello :: String -> (CString -> IO a) -> IO a hello = "Hello, world!" foreign export ccall hello :: String -> (CString -> IO a) -> IO a You want a CString .