From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id 30047BBAF for ; Sat, 24 Oct 2009 15:16:21 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ao0BAO+a4krRVdvNkGdsb2JhbACRWYkbPwEBAQEJCQwHEwOIMKFcgTuGKIhoAQMDBYQ6BA X-IronPort-AV: E=Sophos;i="4.44,617,1249250400"; d="scan'208";a="49203925" Received: from mail-ew0-f205.google.com ([209.85.219.205]) by mail4-smtp-sop.national.inria.fr with ESMTP; 24 Oct 2009 15:16:20 +0200 Received: by ewy1 with SMTP id 1so8470197ewy.27 for ; Sat, 24 Oct 2009 06:16:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type; bh=YbeAsHpcy+eX+oedcx/N0OrbOTNJYXZjMGKkUf/W4ek=; b=hSl13SKa95cwi8KU97dFIMYZ0522EYC+pKvQP53afP+sF22d8REyDHk8G2uG/+dUGx 4o4bv33OvuKpjGTSTGluzhvnrL9W1463XvkIE8ki6VeNEyztTMkkgUPfbv39n7Bg0EX1 RYWJrxgWqmAizYhbZMKkKpwURvq0g3TjZdN90= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=ty0u7PscQPPvsy2JU71lqZI3Vy20t0Ma57wqQMrl/fgnevCIOchAHXtUKrrvklOGzQ ki8EmdxtbbCNCZgTONkIIDR5+nMDU1Md731pK86bZkwoQGfHNVcUjHFjEmeMGoHftoHG 9UfxSqZWkjOISRlci9Up3vVKR8I02pFOyl/4o= MIME-Version: 1.0 Received: by 10.211.154.7 with SMTP id g7mr4226444ebo.10.1256390179326; Sat, 24 Oct 2009 06:16:19 -0700 (PDT) Date: Sat, 24 Oct 2009 15:16:19 +0200 Message-ID: <666572260910240616k16a24865x9946b50bcfb9d181@mail.gmail.com> Subject: [Caml-list] [ANN] ocaml-gir: automated binding generator From: Adrien To: Caml Mailing List Content-Type: text/plain; charset=ISO-8859-1 X-Spam: no; 0.00; preprocessed:01 gcc:01 annotations:01 tarball:01 annotations:01 camlidl:01 idl:01 variants:01 camlidl:01 structs:01 ocaml:01 source-code:01 git:98 git:98 frs:98 I'm pleased to announce a preview release of ocaml-gir. ocaml-gir is an automated binding generator for glib-based libraries. It works by parsing the output of gobject-introspection[0] which in turn works by parsing header files. gobject-introspection doesn't work on preprocessed sources and is able to take advantage of the glib-style C macros to improve the library interface description. It is currently in alpha/beta stage and is able to bind most of WebKit-gtk and DBus-GLib and both are working here. Other libraries are *partially* supported (i.e. gcc finds errors in the C code). The description of the libraries is often broken because of gobject-introspection itself (it strips out GError** paramaters...) or incomplete because of a lack of annotations. ocaml-gir is hosted on the ocamlcore forge[1] using git and its sources are accessible through git-web[2]. A tarball is also available[3]. ocaml-gir ships with the .gir/.xml files generated by this tool and modified to fix various errors, expand annotations or improve the caml-side api (only once right now). Therefore, trying to use gobject-introspection to generate the description again is not advised. There is README explaining quickly how to use ocaml-gir in the source folder. Compared to camlidl, its main advantage is to work on .h files rather than on .idl ones. My first motivation for ocaml-gir was to get webkit-gtk. I knew its API was changing often and I didn't feel like checking everything every few weeks. Another difference is that ocaml-gir tries to follow lablgtk's API style. For example, it uses polymorphic variants to bind C enums. Moreover, I wasnt't sure how camlidl was going to handle structs named like WebKitWebView which ocaml type should be web_view. However ocaml-gir probably has a ton of bugs and isn't complete yet (the api exposed will change a bit and every "feature" isn't bound). Also, one has to keep in mind automated binding generation from C isn't magic. An int* could be an int array or an out-parameter and int** or int*** would be even more annoying to deal with. It requires source-code annotations. A language with an actual array type and richer types, with functions able to easily return several values and with exceptions may not need them. [0] http://live.gnome.org/GObjectIntrospection [1] https://forge.ocamlcore.org/projects/ocaml-gir/ [2] http://git.ocamlcore.org/cgi-bin/gitweb.cgi?p=ocaml-gir/ocaml-gir.git [3] https://forge.ocamlcore.org/frs/download.php/286/ocaml-gir-preview.tar.gz --- Adrien Nader