c2hs

C->Haskell FFI tool that gives some cross-language type safety https://github.com/haskell/c2hs

Version on this page:0.28.2
LTS Haskell 9.13:0.28.2
Stackage Nightly 2017-11-18:0.28.2
Latest on Hackage:0.28.2
GPL-2 licensed by Manuel M T Chakravarty
Maintained by chak@cse.unsw.edu.au, duncan@community.haskell.org, ian@skybluetrades.net, aditya.siram@gmail.com

Module documentation for 0.28.2

There are no documented modules for this package.

`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](https://github.com/haskell/c2hs/wiki/Home). Also see the
[user guide](https://github.com/haskell/c2hs/wiki/User-Guide) (also
available in the `doc` directory of the repository).


## Installing

See the file `INSTALL`.


## Copyleft

This system is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.

This system is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.

You should have received a copy of the GNU General Public License
along with this system; if not, write to the Free Software Foundation,
Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

> **NOTE HOWEVER**, all code included into generated bindings is under
> a BSD-style license that does not place any restrictions on the
> license of the inteface produced with `c2hs` (ie, closed proprietary
> licenses are possible, too). In other words, I do not care what you
> use `c2hs` for or to whom you are giving `c2hs` or any interfaces
> generated with `c2hs`, only if you modify or improve `c2hs` itself,
> you have to contribute your changes back to the community.
> Nevertheless, I will of course be particularly delighted if you
> choose to make your work freely available.


## Credits

See the file `AUTHORS`.

Changes

0.28.2
- Switch to language-c 0.6 [#176]
0.28.1
- Switch to language-c 0.5 [#157]
- Fix class hook problem with imports [#155]

0.27.1
- Alternate specification for sizes in "+" parameters [#140]
- Fix regression to do with incomplete structure types [#152]
- Fix pattern match error [PR #153] (deech)

0.26.2
- Missing import bug [#151]
- Parameter count checking for {#fun ...#} [#149]
- Error message for "incomplete types" [#141]

0.26.1
- Better error messages [PR #139] (Noam Lewis)
- Fix for OS X block syntax [#138] (Anthony Cowley)
- Minimal support for va_list [PR #137] (Andy Adams-Moran)
- Reorganise treatment of standard library imports used by C2HS
[#136] (https://github.com/haskell/c2hs/blob/master/import-handling.md)
- C structure tag/typedef confusion bug (caused problems for flock on
OS X) [#134]
- C typedefs to void pointers [#133]
- Bool wrappers for unnamed parameters in C function definitions
[#131]
- Incorrect wrapping of some pure C functions [#130]

0.25.2
- Test fixes to work with GHC 7.10.1

0.25.1
- Marshalling for C bool values [#128]

0.24.1
- Revert bad fix for bool handling [#127]
- Wrapper generation for bare structure arguments [#117] plus custom
setup script to support Cabal builds on versions of Cabal without
explicit support for extra C sources generated by preprocessors
(@RyanGIScott)
- Arrays in structuress bug [#123]
- Test fixes for Windows

0.23.1
- Typedef and default marshalling hooks [#20, #25, #48]
- Test fixes for 32-bit platforms (J├╝rgen Keck: @j-keck)
- Multi-character constants for OS X [#15]
- Better support for binding to variadic functions [#102]

0.22.1
- First (not very good) implementation of support for variadic
functions [#102]
- Default marshallers for Char types [#98]
- Improve sizeof computations [#9, #10]

0.21.1
- Parametrized pointer types in pointer hooks [#36]
- Special "+" parameters for efficient foreign pointer marshalling [#46]
- Add default marshallers for C types [#83]
- Fix treatment of arrays within structs [#115]
- Add ability to omit given enum values [#116]
- Regression suite tidy-ups


0.20.1
- Get CUDA Travis tests working again (hopefully...)
- Modify approach for defining C2HS_MIN_VERSION macro to work with
NVIDIA's nvcc CUDA compiler [#111]
- Fix problem with parser for {#enum ...#} renamings [#113]


0.19.1
- Add {#const ...#} hook for accessing #defined constants [#65]
- Persist enumeration definitions across modules [#103]
- Add nocode keyword for enumeration definitions [#70]
- Bump version for language-c to fix OS X problems [#82, #85] (thanks to
Anthony Cowley and Benedikt Huber for help with this)
- Add finalizer support to foreign pointer definitions [#73]
- Comment parsing cleanups (Sivert Berg: @sivertb)


0.18.2
- Add C2HS_MIN_VERSION(major,minor,revision) preprocessor macro
- Suppress regression suite build (and associated dependency
installation) for non-Travis cases
- Fix Cabal file to include previously missing tests


0.18.1
- Numerous improvements to Enum handling [#78] (Philipp Balzarek:
@Philonous)
- Handle Haddock comments within C2HS hook definitions [#62] (@tangboyun)
- Better error messages for missing files (Zejun Wu: @watashi)
- Write CHS dump files to output directory (Zejun Wu: @watashi)
- Handle C calling conventions within function pointer declarations [#88]
(Michael Steele: @mikesteele81)
- Fix FreeBSD libssh2 problem [#87] (Cindy Wang: @CindyLinz)
- Better error messages for hook syntax errors (Ryan Scott: @RyanGIScott)
- Fixes for GHC 7.9 [#100] (@int-index)
- Fix test suite to use C2HS from dist directory [#81]
- Allow free intermixing of command line options and input files [#86]
- Treat CLang "block" syntax and other "non-GNU" issues differently:
always undefine __BLOCKS__ CPP symbol to avoid problems with blocks;
add nonGNU directive to trigger undefine of GNU-specific pre-processor
symbols [#77]
- Handle indented CPP directives correctly [#80]
- Handle #sizeof and #alignof on non-typedef's structures [#95]
- Fix #get and #set hooks to access newtyped pointers [#96]
- Fix round-trip problem for interface files caused by changes in
language-c [#87]
- Treat "with" specially so that it can appear both as a marshaller
identifier in an input parameter definition and as a keyword in enum
definitions [#93]
- Temporarily disable CUDA regression suite examples (CUDA install
problems on Travis)


0.17.2
- Fix more regressions from 0.16.6 (affected packages included
gnome-keyring, hsndfile and cuda)
- Add regression suite tests to reduce chances of future regressions


0.17.1

- Fix regressions from 0.16.6 (caused by fix for issue #45)
- Version number bump (should have been done in the last release)


0.16.6

- Trivial integer casts in enum defines supporting typedefs [Anton Dessiatov]
- Allow forward definition of enums (issue #23)
- Binding of C enums with aliases (issue #38)
- Default marshallers for enum and pointer hooks (issue #31)
- Remove dependencies on C2HS module from marshalling code (issue #37)
- Problem with MacOS blocks notation (issue #29)
- Include directive on first line produces invalid Haskell (issue #16)
- Add command-line switch to suppress GNU preprocessor symbols (issue #60)
- Fix size and alignment computation of bitfields [Facundo Dominguez]
- Allow prefixes to be replaced, not just removed (issue #19)
- Allow reference to structure tags from accessors (issue #54)
For access paths for {#get#}, {#set#}, etc., one can now specify
that structure tags are to be searched preferentially by saying,
for example, {#get struct _point->y#} instead of {#get _point->y#}.
The latter case will search for typedef names first and only then
structure tags.
- Support for anonymous enums (issue #43)
- with... unwrapper type declarations for pointer hooks (issue #44)
- {#fun...#} indentation for use in where clauses (issue #45)
- incorrect method names from terminal class in superclass
instances (issue #21)
- "offsetof" directive (issue #22)
- --include flag cannot handle windows paths (issue #30)
Now uses System.FilePath splitSearchPath function, which should be
platform-agnostic.
- Void functions produce "defined but not used" warning (issue #47)
Handle fun hooks with a void result using ">>" instead of ">>=".
- Add CPP undefine flags for Gnu compiler defines (issue #51)
- Cabal test suite


0.16.5

- Migration to GitHub; documentation changes.


CHANGES ABOVE THIS POINT ARE FOR VERSIONS AFTER THE MOVE OF THE REPOSITORY
TO GITHUB. FOR EARLIER CHANGES SEE ChangeLog.old.
comments powered byDisqus