Manuel M. T. Chakravarty wrote:
> I think, there are five options:
> 
> * H/Direct (you mentioned that already)
> * GreenCard (ditto)
> * C->Haskell
>   http://www.cse.unsw.edu.au/~chak/haskell/c2hs/
> * hsc2hs (comes with GHC)
> * Plain FFI

Plus:

  * Write your own IDL compiler for a given formal description of an API

This sounds a little bit like overkill at first, but at least for my
never-ending HOpenGL project it makes a lot of sense: There is a rather
large (maintained!) description of the OpenGL API (plus a few more things
like GLX) at

   http://oss.sgi.com/cgi-bin/cvsweb.cgi/projects/ogl-sample/main/doc/registry/specs/

which could be used to generate header files, network code for GLX, stubs,
etc. (and of course a low-level Haskell binding :-)  Of course one could hack
H/Direct in a way that it understands these .spec files, but a home-grown
compiler was the easier and more tunable way. I hope to release a new
version of HOpenGL based on this "soon".   :-}

SimonM has written a small program/hack to auto-generate something for GTK+,
IIRC, so I'm probably not alone on this route...

I agree with Koen on his points:

   * Plain FFI plus a few combinators is not so bad at all for small to
     medium-sized bindings. Only the mapping of Haskell enumerations to
     C enums/ints and back is *really* boring...

   * No tool whatever generates a Haskellish binding one wants to present
     to an end user, so a wrapper around the lower Haskell level is
     necessary, anyway.

Manuel: Could the results/opinions of this thread added somewhere? I'm not
sure where, the libraries/tools page of haskell.org is a possibility, but
your page could be used, too.

Cheers,
   S.
-- 
Sven Panne    Fon: +49/89/99567000    Fax: +49/89/99567461
BetaResearch GmbH,    Betastr. 1,    D-85774 Unterfoehring
mailto:[EMAIL PROTECTED]    http://www.betaresearch.de

_______________________________________________
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

Reply via email to