Fork me on GitHub

cgen

cgen generates Haskell bindings to C++ libraries

Installation

Note: you need Haskell cabal for installing cgen.

Install from Hackage:

cabal update && cabal install cgen
Install from source:
$ git clone git://github.com/anttisalonen/cgen
$ cd cgen
$ cabal configure [--user] && cabal build && cabal install

Usage

  1. Write an interface file for cgen
  2. cgen -o c/output/dir --interface my-interface-file --include path/to/cpp/headers cpp-header1.h cpp-header2.h ...
  3. Write an interface file for cgen-hs
  4. cgen-hs -o hs/output/dir --interface my-cgen-hs-interface-file c/output/dir/*.h

Interface files for cgen

Example: @exclude ^_.* .*Listener # This is a comment. getErrorDescription getSetting @header OGRE/Ogre.h @rename uint|unsigned int ulong|unsigned long ushort|unsigned short # Superclass typedefs. TransformSpace|Node::TransformSpace DebugRenderable|Node::DebugRenderable String|char* @exclude-class .*Listener

Interface files for cgen-hs

Example: @exclude Ogre_Vector3_ptr1 Ogre_Vector3_ptr .*Listener_.* @default-in char*

Examples

Hello world, or using cgen with a simple C++ library.

For a complete example, see hogre.

License

BSD

Authors

Antti Salonen (ajsalonen@gmail.com)