Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cabal FFI dependency

Tags:

I am making a small Haskell game in Windows, where I would like to respond each time the user presses a key. Because getChar behaves strangely on Windows, I use FFI to get access to getch in conio.h, as described here. The relevant code is:

foreign import ccall unsafe "conio.h getch" c_getch :: IO CInt

This works fine, when I run it in ghci, or compile it with ghc. I also want to try making a cabal package out of it, so extending from this question, I include the following in my cabal file:

...
executable noughts
  Includes:          conio.h
  Extra-libraries    conio
...

But when I run cabal configure, it tells me:

cabal: Missing dependency on a foreign library:
* Missing C library: conio

It makes sense, because in my haskell platform directory, under ...\Haskell Platform\2012.4.0.0\mingw there is a conio.h file under the include directory, but no other conio file to provide the object code.

Am I doing this the right way, and if so, how can I find out which library to include in my cabal file?