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 _______________________________________________ Caml-list mailing list. Subscription management: http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list Archives: http://caml.inria.fr Beginner's list: http://groups.yahoo.com/group/ocaml_beginners Bug reports: http://caml.inria.fr/bin/caml-bugs