c2hs is a pre-processor for Haskell FFI bindings to C libraries
Haskell C Objective-C C++ Makefile Shell
Clone or download
Latest commit 072ec27 Jul 10, 2018
Permalink
Failed to load latest commit information.
doc Fix typo Jul 10, 2018
examples/libghttpHS Move c2hs modules under src/ Jun 20, 2008
regression-suite-vm Merge branch 'issue-136' Jun 22, 2015
src Fix some typos in Errors.hs Jun 8, 2018
tests Bump version to 0.28.3, upgrade to language-c-0.7.1. Nov 25, 2017
.boring Remove postInst.sh Jul 15, 2005
.gitignore Fix #155 Jan 17, 2016
.travis.yml [travis-ci] Upgrade alex, happy and cabal-install. Jan 22, 2017
AUTHORS Update AUTHORS, README and INSTALL Feb 28, 2009
C2HS.hs Deprecation notice for C2HS module. Jan 18, 2014
COPYING rearranging darcs repo May 18, 2005
ChangeLog Bump version to 0.28.3, upgrade to language-c-0.7.1. Nov 25, 2017
ChangeLog.CTKlight Move the base modules under src/ Jun 20, 2008
ChangeLog.old Change log reorganisation Mar 12, 2014
INSTALL Update AUTHORS, README and INSTALL Feb 28, 2009
README Add plain README back for Cabal Aug 11, 2013
README.CTKlight rearranging darcs repo May 18, 2005
README.md [travis-ci] Add build status to README.md. Jan 22, 2017
REGRESSION-SUITE Add notes about regression suite. Apr 14, 2014
Setup.hs Use Cabal's mechanism to find the datadir rather than our own Feb 9, 2007
TODO Add note to TODO about cpp directives on first line Jul 26, 2007
TODO.CTKlight Move the base modules under src/ Jun 20, 2008
appveyor.yml Fixes relocatable GCC and Windows support Apr 19, 2018
c2hs.cabal Add issue-192 directory to Cabal file. Jun 5, 2018
custom-setup.hs Add Ryan's custom setup script Mar 8, 2015
import-handling.md Import handling document formatting Jun 22, 2015

README.md

Build Status

c2hs is a interfacing tool that eases Haskell access to C libraries. The tool gets information about the C data type definitions and function signatures by analysing the C header files of the library. It uses this information to compute the missing details in the template of a Haskell module — called the binding file — that implements a Haskell binding to the C library. Hooks embedded in the binding file signal where, which, and how C objects are accessed from Haskell. The Haskell code in the binding file determines Haskell types signatures and marshaling details.

Further information is on the wiki. Also see the user guide (also available in the doc directory of the repository).

Installing

To install c2hs from Hackage:

cabal install c2hs

If you like to build from the GitHub repository, see the file INSTALL. See the REGRESSION-SUITE file for a description of how to run the regression suite for checking C2HS performance against existing Haskell packages that use it.

License

All code generated by c2hs is under a BSD licence. Hence, c2hs is useful for both open and closed source projects.

The tool itself is released under the GPLv2. This is the same situation as for the GNU C Compiler. For details, see the file COPYING.