Important changes (especially those affecting the semantics of the tool) are documented in the following.
New C parser that can parse all of C99 and GNU C
Make c2hs integrate better with Cabal (1.2 and later)
Adapted to GHC 6.8.
Now requires Cabal 1.2.
Lots and lots of old code removal
Several bug fixes and improvements from Udo Stenzel:
allowing variadic functions in structures
allowing call and fun hooks for FunPtrs in C structs
embedded arrays size calculated correctly
Added nocode
directive to pointer hooks
Can use structs properly in pointer hooks now (contributed by Jelmer Vernooij)
upcaseFirstLetter
and
downcaseFirstLetter
Cross-compiling with --platform
flag
Gcc's asm
construct is supported (contributed by
Duncan Coutts)
Hierarchical modules syntax in import
hooks supported
No separately installed marshaling library anymore; as a result binary C➔Haskell packages and installations are now independent of the targeted Haskell system
New lexer and parser generated with Alex and Happy (contributed by Duncan Coutts)
Cabal build system
Works with GHC 6.4 and Cabal packages
Strings may contain 8-bit characters (e.g., umlauts).
Identifier may optionally be put in single quotes. (This is useful if they would otherwise collide with a C➔Haskell keyword.)
Some smaller bug fixes
C chars are treated as integral types for marshalling purposes.
If there is no explicit output file specified, the generated header
file is put in the same directory as the binding file; otherwise, it
goes in the directory where the output file is put. Moreover, the
--output-dir
option enables the specification of
directory where all generated files are to be put.
Foreign import declarations include the name of the header file generated by C➔Haskell (ie, it needs neither be passed to the Haskell compiler at the command line nor in an OPTIONS pragma).
We allow structs and unions with no declarations.
Headers including function bodies are now parsed correctly.
Duncan Coutts identified a space leak in the parser whose removal improved performance significantly.
Removed support for deprecated C2HS
interface and for old versions of the FFI libraries
Improved line pragma generation
Works with GHC 6.3
Builds on Mac OS X thanks to a patch by Sean Seefried
Bug fixes
Constant expression can now contain enumerators
header
label removed from context
hooks
This version of c2hs
may
overwrite C header files in the current
directory. More precisely, if a binding module with the name
Foo.chs
is processed, a header file with the name
Foo.h
is generated and will
overwrite any file of the same name in the
current directory or the directory specified via the
-o
option.
Added support for CPP directives, including special treatment of
conditions, and for inline C code; specification of a header file as an
argument to c2hs
is now option.
GHC line pragmas are emitted into generated Haskell code
Swap the order of reading the binding module and the C header (i.e., we now read the binding module first)
Worked around a bug in GHC 5.04.1
Solaris-related fix
Marshalling support for bit masks represented as enumeration types
Added fun
hooks
as
aliases can use ^
convert the
orignal identifier with underscore2case
In call hooks, the attributes `fun' was replaced by `pure' (`fun' is will still be recognised for a while to ensure backwards compatibility, but it's use is deprecated)
GHC's package system is now supported
If two import hooks add a type mapping for a pointer hook with the same name, the textual later one dominates.
Bug fixes
Support for bitfields (they are correctly handled when computing struct
offsets and they can be accessed using set
and
get
hooks)
Some more support for GNU C extensions ("alignof" and better support "__attribute__")
Added class
hooks
Bug fixes
Library names in foreign import
s have been removed
until the convention of the new FFI is implemented (they are currently
silently omitted)
Added sizeof
hooks; sizeof of type names is now also
supported in constant expressions
Local prefix for enum
hooks; courtesy of Armin Sander
Added import
hooks
The documentation includes a description of binding hooks
Added pointer
hooks, which were derived from code
for a similar feature by Axel Simon; this includes proper treatment of
parametrised pointers
Integrated deriving
option for
enum
hooks, which was contributed by Axel Simon
Adapted to GHC 5.0
Adaptation layer for legacy StablePtr
interface
Forgot to export FunPtr
and associated functions
from C2HS
Forgot to export some names in C2HSDeprecated
Added support for gcc's __builtin_va_list
Library adapted to New FFI; the old interface can still be used
by importing C2HSDeprecated
FFI Library specification added to the documentation
CygWin support; based on suggestions by Anibal Maffioletti Rodrigues
de DEUS <anibaldedeus@email.com>
IntConv
instances for Int8
,
Word8
, and Char
Debugged the stripping of prefixes from enumerators; prefixes are now generally stripped, independent of whether they can be stripped from all enumerators of a given enumeration type
Comma now correctly required after
underscoreToCase
.
This breaks source compatibility with previous versions.