The hsc2hs program can be used to automate some parts of the process of writing Haskell bindings to C code. It reads an almost-Haskell source file with embedded special constructs, and outputs a real Haskell file with these constructs processed, based on information taken from some C headers. The extra constructs provide Haskell counterparts of C types, values of C constants, including sizes of C types, and access to fields of C structs.
For more details, see the hsc2hs section in the GHC User's Guide.
Supports generation of response files to avoid system filepath limits (#22, #23)
Fix non-deterministic failures for response file handlings (#29)
Temporary file removals on Windows are not a bit more reliable and should throw less access denied errors. See #25 and (#9775)
Accept a leading single quote for data constructor promotion (#13, #17)
Include template file as first header in hsc2hs generated C file (#28)
On Windows define
__USE_MINGW_ANSI_STDIOto 1 instead of 0 when not already defined in standard template header. This is a more modern default (#28)
Support response files regardless of which GHC
hsc2hswas compiled with (#15758)
Support for non-x86 platforms should be significantly more robust due to improvements in
hsc2hs’s assembly parser
Add support for haskell files that use a leading single quote for promoted data constructors.
- Add support to read command line arguments supplied via response files (#13896)
Support GHC 8.2.1
hsc_alignmentmacro work in clang (D3346)
Track column numbers to improve GHC’s caret diagnostic display (#13388)
Fix type signature of generated
maintest function to avoid C compiler warnings about unused
argvfunction parameters during feature testing.
Double-escape paths used to build call to