I'd like to try c2hs. I'm looking at the doc here : https://github.com/haskell/c2hs where they say it's possible to install it via cabal. However how can I run executable from cabal ? I'm used to use cabal to download and build dependencies, but I never ran tool with it.
on top of that I looked at inline-c, it looks promising too, but handling C struct requires to use "manual" code if I understand inline-c-nag correctly
I'd like to try c2hs. I'm looking at the doc here : https://github.com/haskell/c2hs where they say it's possible to install it via cabal. However how can I run executable from cabal ? I'm used to use cabal to download and build dependencies, but I never ran tool with it.
cabal will automatically run c2hs for files with the extension
.chs
, you just have to add c2hs to thebuild-tool-depends
thank you !
but what is chs file ?
it's what c2hs consumes!
yes but what is it supposed to contain ? I suspect it's not a C header
it's all explained here:
https://github.com/haskell/c2hs/wiki/Implementation-of-Haskell-Binding-Modules
thank you !
was looking at the "usage of c2hs" page
the doc is pretty hard to read in general imo
just ask here if you don't get something
it definitely helps to know how CFFI works in general
I gave it a try, and also tried hsc2hs, I'm a bit confused by the purpose of both tools
they seem to provide the same functionnalities with slighlty different syntax
on top of that I looked at inline-c, it looks promising too, but handling C struct requires to use "manual" code if I understand inline-c-nag correctly
by the way is it possible to encode a c struct outside of a IO() monad ?
peek
andpoke
seems to be IO onlydoubt it