我正在 Windows 中制作一个小型 Haskell 游戏,我想在用户每次按键时做出响应。因为在 Windows 上的getChar 行为很奇怪,所以我使用 FFI 来访问getchin ,如此处conio.h所述。相关代码为:
foreign import ccall unsafe "conio.h getch" c_getch :: IO CInt
当我在 ghci 中运行它或用 ghc 编译它时,这很好用。我也想尝试用它制作一个 cabal 包,所以从这个问题扩展,我在我的 cabal 文件中包含以下内容:
...
executable noughts
Includes: conio.h
Extra-libraries conio
...
但是当我运行时cabal configure,它告诉我:
cabal: Missing dependency on a foreign library:
* Missing C library: conio
这是有道理的,因为在我的haskell平台目录下,该目录下...\Haskell Platform\2012.4.0.0\mingw有一个conio.h文件include,但没有其他conio文件提供目标代码。
我这样做的方式是否正确,如果是这样,我怎样才能找出要包含在我的 cabal 文件中的库?