English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    
Browse thread
[Caml-list] [ANN] cowboy and cowboy/glib preview, C binding generation framework
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Adrien <camaradetux@g...>
Subject: [Caml-list] [ANN] cowboy and cowboy/glib preview, C binding generation framework
Hi,

I am pleased to announce a preview release of cowboy, a framework for
the generation of C bindings. It is currently used to generate
bindings for glib-based libraries.

It's not a magical binding writer however: work is still needed in
order to create bindings. But it can ease their generation, help avoid
regular expression stunts and allow writing the generator in ocaml.

It provides an access to the list of a library's functions, enums,
structs... Yohann Padioleau's yacfe[2] C/C++/Java parser actually does
most of the work. It can "parse" cpp (the preprocessor kind), giving
access to valuable human-readable information.
The code in cowboy takes yacfe's output and simplifies it: dropping
function's implementation and only keeping names and prototypes. It
also keeps comments which often (doxygen, gtk-doc...) contain
annotations to tell an 'int array' from an 'out parameter', both being
'int*' in C.

Cowboy also provides a few helper functions and a sort of templates
for META, OCamlMakefile and OASIS files.


Currently, cowboy is used to generate bindings to glib-based libraries
(webkit-gtk is almost ready, others will follow). However it is not to
be used for everything.
Stating the obvious, it is only interesting when automation is worth
it. If the library is not big enough or if its API does not follow a
set of conventions, writing bindings by hand will be easier.


In any case, do not hesitate to ask me: on the mailing-list, through
private e-mail, or on IRC (freenode network, #ocaml or #ocaml-fr
channels, which I'm always connected to).


PS: Some have seen and might remember "ocaml-gir" which did a similar
job: cowboy has a more general scope and is also easier to work with
(gobject-introspection is very complex and under-documented, and it's
... weird).

PS2: I am aware that cowboy is unevenly documented. If you start
anything, again, do not hesitate to ask me.

[1] http://git.ocamlcore.org/cgi-bin/gitweb.cgi?p=cowboy/cowboy.git
(use the "snapshot" feature to download)
[2] http://padator.org/software-yacfe.php (see doc/yacfe on how to install it!)

 ---

Adrien Nader