From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id RAA31682; Mon, 26 Apr 2004 17:20:52 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id RAA31402 for ; Mon, 26 Apr 2004 17:20:50 +0200 (MET DST) Received: from mail6.speakeasy.net (mail6.speakeasy.net [216.254.0.206]) by concorde.inria.fr (8.12.10/8.12.10) with ESMTP id i3QFKmYM001695 for ; Mon, 26 Apr 2004 17:20:49 +0200 Received: (qmail 29858 invoked from network); 26 Apr 2004 15:20:45 -0000 Received: from dsl081-145-152.chi1.dsl.speakeasy.net (HELO firebird) ([64.81.145.152]) (envelope-sender ) by mail6.speakeasy.net (qmail-ldap-1.03) with SMTP for ; 26 Apr 2004 15:20:45 -0000 Date: Mon, 26 Apr 2004 10:17:46 -0500 From: art yerkes To: Yamagata Yoriyuki Cc: caml-list@inria.fr Subject: Re: [Caml-list] swig like library... Message-Id: <20040426101746.4a1a1fdc.ayerkes@speakeasy.net> In-Reply-To: <20040425.181100.78702024.yoriyuki@mbg.ocn.ne.jp> References: <1082837516.9537.114.camel@pelican.wigram> <20040424202443.05043abc.ayerkes@speakeasy.net> <20040425.181100.78702024.yoriyuki@mbg.ocn.ne.jp> X-Mailer: Sylpheed version 0.9.10 (GTK+ 1.2.10; x86_64-unknown-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Miltered: at concorde by Joe's j-chkmail ("http://j-chkmail.ensmp.fr")! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; yerkes:01 ayerkes:01 caml-list:01 swig:01 2004:99 yamagata:01 yoriyuki:01 yoriyuki:01 yerkes:01 ayerkes:01 caml-list:01 swig:01 2004:99 bottleneck:01 forking:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Sun, 25 Apr 2004 18:11:00 +0900 (JST) Yamagata Yoriyuki wrote: > From: art yerkes > Subject: Re: [Caml-list] swig like library... > Date: Sat, 24 Apr 2004 20:24:43 -0500 > > > I agree that the lack of further automation is a bottleneck for SWIG > > users. I have considered forking some of the core type functions into the > > ocaml module for that reason. > > I think swig is nice. It does the supposed job, quick and dirty > interface to C. > > I have only minor complaints. First, the access to structure fields > involves searching assoc lists, using string as a key. As a result, > my program spends a lot of time in comparing strings. A possible and > easy improvement is making access functions for structure fields > accessible from the outside. > > Another problem, which may not be a swig problem, is that my program > occasionally crash. malloc in a structure creation function (new_*) > causes seg fault. Could you give me a suggestion where I have to > look? Please send me more details privately about the crash. That may indeed be a bug in my module. You make a good point about method lookup, I will make that faster. In order to make the accessors for structs available outside the object, I would have to decorate some names in ugly, and possibly difficult to remember ways. I wonder if you (or other SWIG users) have any suggestions which would eliminate that or make it easier. The simplest way I considered was to have a repository of method names, as I do with enum labels: type methods_of_foo = [ `Constructor | `Foo | `foo | `_foo | `fOo ... | `operatorLessThanOrEqual ] And then do the obvious thing in the method call function. This means that code written without camlp4 will be much uglier, and that you may have to cast your method names. The operators will also be uglified. I could make member variable accessors different from the methods... Would that be desirable? -- Hey, Adam Smith, keep your invisible hands to yourself! ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners