From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id p06DF8qW005929 for ; Thu, 6 Jan 2011 14:15:08 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AvoAACJPJU3RVdc2kGdsb2JhbACVWY44CBUBAQEBCQkMBxEEIKZLiXiCFYRPLoYFAQEDBYVHBIUjhWaGEw X-IronPort-AV: E=Sophos;i="4.60,283,1291590000"; d="scan'208";a="86166280" Received: from mail-ew0-f54.google.com ([209.85.215.54]) by mail2-smtp-roc.national.inria.fr with ESMTP; 06 Jan 2011 14:15:08 +0100 Received: by ewy24 with SMTP id 24so8548686ewy.27 for ; Thu, 06 Jan 2011 05:15:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type; bh=k7NBEJ/CKz5bcEUHfIQ0WDNGJn2pEa9BeALQhpg9N/w=; b=EMUNlHo4vfIyo/mIFwRgnek4RB9h76Ea1OerzwstT5DlvBfqkcT3qFFma3GfenLfCE v6BZpfCAcsKHNvS0huWxed+S8v7nTlEw5Ssq7kxU9d5JvvISkZLcPv5+020l2azRCWhA AtHd2nCYl7wU/qO/UDIMMk++BlZ0a12CvnZWY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=okkDlsCezWxqrC6lY7UScn/enw7U5eMAbxlfcOBELy5nzkGgDGvyHuC/67If3Whp55 XSt79MpeQI/BtEhU1KP6tSfDlwHLKM9Zu37BBh1qQVNEptTPVXn8dY354nJOG7dbKNHG okeeQFy7auqJJ6Y9Ajy6XEpFhF548tdYasZHc= MIME-Version: 1.0 Received: by 10.213.34.5 with SMTP id j5mr17999077ebd.27.1294319707209; Thu, 06 Jan 2011 05:15:07 -0800 (PST) Received: by 10.213.33.6 with HTTP; Thu, 6 Jan 2011 05:15:07 -0800 (PST) In-Reply-To: References: Date: Thu, 6 Jan 2011 14:15:07 +0100 Message-ID: From: Adrien To: Joel Reymont Cc: caml-list@inria.fr Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [Caml-list] replacing swig Hi, You need annotations in the code. There's just no way to guess this. And you'd have to guess for out-parameters too, and maybe also "ownership" (who will have to free the object), and length of arrays (end delimiters)... For an overview of which kind of info you want, see: http://live.gnome.org/GObjectIntrospection/Annotations As you'll see, there is a project named gobject-introspection: the annotations in comments around functions are parsed and an XML file is created. I started a project named "ocaml-gir" to take advantage of that and, really didn't enjoy working with it. I've actually stopped developping it completely: I've even emptied git HEAD so people are less likely to use it. Working with a bad tool outputting bad data wasn't a lot of fun. I then started "cowboy"[1] which uses yacfe to parse source files, simplifies its output a bit and then parses the gobject annotations to create bindings. It's possible to do do that for non-gobject projects too. There should be more info in the announcement from a few months ago[2]. I've had no time to spend on the documentation unfortunately but if you need help/details, I'll help (although, not before saturday). You might also want to look at qtcaml[3]. It interfaces with gccxml and it should also be possible to use this interface and only write an "adapter" like you'd do with cowboy. Whatever you do, unless you have a magic wand, you will need annotations and a "regular" interface: it should follow a set of standards/rules. If you have troubles remembering the interface, how could you make a computer understand it? Changing the interface of the project won't be possible usually but adding annotations upstream shouldn't be a problem. It might take time but you'll probably get help from the project members. [1] http://git.ocamlcore.org/cgi-bin/gitweb.cgi?p=cowboy/cowboy.git;a=summary [2] http://caml.inria.fr/pub/ml-archives/caml-list/2010/08/9b3412eabe356c5740441fb017d84911.en.html [3] http://qt-caml.crapulion.org/trac Regards, Adrien Nader On 06/01/2011, Joel Reymont wrote: > Suppose you are writing a SWIG replacement based on gccxml, gcc plugins, > etc. > > How would you figure out if the user meant char** as a pointer to a string > vs an array of characters? > > SWIG handles this with typemaps. Does this mean that whatever replaces SWIG > would also require a typemap DSL? > > --- > http://wagerlabs.com | @wagerlabs | http://www.linkedin.com/in/joelreymont > > > > > > > > -- > Caml-list mailing list. Subscription management and archives: > https://sympa-roc.inria.fr/wws/info/caml-list > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs > >