
Can I use cabal to build packages that incorporates C libraries and FFI Haskell created using c2hs? Any pointers on how to do that? /M -- Magnus Therning (OpenPGP: 0xAB4DFBA4) magnus@therning.org Jabber: magnus.therning@gmail.com http://therning.org/magnus Software is not manufactured, it is something you write and publish. Keep Europe free from software patents, we do not want censorship by patent law on written works. If voting could really change things it would be illegal.

On Mon, 2006-11-27 at 22:26 +0000, Magnus Therning wrote:
Can I use cabal to build packages that incorporates C libraries and FFI Haskell created using c2hs?
Yes you can. Cabal understands a bit about .chs files. I think all you need to do is specify the module in the exposed-modules or other-modules and Cabal will find the .chs file and try to build a .hs file from it. However at the moment your .chs files cannot import each other because Cabal doesn't to any dependency analysis. That means you can't use c2hs's {# import #} hooks. An initial patch was posted to the cabal-devel mailing list to do this properly but it hasn't been integrated yet. Duncan

On Tue, Nov 28, 2006 at 00:33:42 +0000, Duncan Coutts wrote:
On Mon, 2006-11-27 at 22:26 +0000, Magnus Therning wrote:
Can I use cabal to build packages that incorporates C libraries and FFI Haskell created using c2hs?
Yes you can. Cabal understands a bit about .chs files. I think all you need to do is specify the module in the exposed-modules or other-modules and Cabal will find the .chs file and try to build a .hs file from it.
Thanks, that's really good.
However at the moment your .chs files cannot import each other because Cabal doesn't to any dependency analysis. That means you can't use c2hs's {# import #} hooks.
An initial patch was posted to the cabal-devel mailing list to do this properly but it hasn't been integrated yet.
I'll keep that in mind. I'm still having some problems though :-( I thought I'd start with a minimal, rather silly, test to see if I can get Cabal to do what I want. I've stuck what I have at http://www.therning.org/magnus_files/cnh.tar.gz It fails to build for me with the following error: Preprocessing executables for cnh-0.1... Building cnh-0.1... [1 of 2] Compiling Foo ( src/Foo.hs, dist/build/cnh/cnh-tmp/Foo.o ) src/Foo.chs:6:8: parse error on input `import' I tried using '-v5' but it didn't really offer anymore insight for a novice like me :( /M -- Magnus Therning (OpenPGP: 0xAB4DFBA4) magnus@therning.org Jabber: magnus.therning@gmail.com http://therning.org/magnus Software is not manufactured, it is something you write and publish. Keep Europe free from software patents, we do not want censorship by patent law on written works. Increasingly, people seem to misinterpret complexity as sophistication, which is baffling--the incomprehensible should cause suspicion rather than admiration. -- Niklaus Wirth
participants (2)
-
Duncan Coutts
-
Magnus Therning