为haskell写c绑定库,并发布到hackage #14
wujilingfeng
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
本教程介绍如何为haskell写c绑定库。
工具: cabal,hsc2hs(cabal自带),haddock
关于hsc2hs的介绍可以参考这里,更多关于c2hs可以参考这里。
haddock用来为haskell程序生成文档,它的语法参考这里,可以用
cabal install haddock
安装haddock,在项目运行cabal haddock
生成文档。cabal init --interactive
新建haskell项目其中extra-libraries是依赖的c语言库,extra-lib-dirs是库的搜索路径,include-dirs是头文件的搜索目录,includes是头文件,是c-sources是c语言源文件。
配置好上面的选项,然后运行
cabal sdist
就可以上传到hackage了。Beta Was this translation helpful? Give feedback.
All reactions