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 TAA08697; Mon, 17 May 2004 19:03:57 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id TAA08686 for ; Mon, 17 May 2004 19:03:55 +0200 (MET DST) Received: from smtp.mbg.ocn.ne.jp (mbg.ocn.ne.jp [210.190.142.181]) by nez-perce.inria.fr (8.12.10/8.12.10) with ESMTP id i4HH3rEV016921 for ; Mon, 17 May 2004 19:03:54 +0200 Received: from localhost (p7160-adsau14hon-acca.tokyo.ocn.ne.jp [220.111.167.160]) by smtp.mbg.ocn.ne.jp (Postfix) with ESMTP id 60CE16384; Tue, 18 May 2004 02:03:52 +0900 (JST) Date: Tue, 18 May 2004 02:03:06 +0900 (JST) Message-Id: <20040518.020306.63133771.yoriyuki@mbg.ocn.ne.jp> To: ayerkes@speakeasy.net Cc: caml-list@inria.fr Subject: Re: [Caml-list] swig like library... From: Yamagata Yoriyuki In-Reply-To: <20040426101746.4a1a1fdc.ayerkes@speakeasy.net> References: <20040424202443.05043abc.ayerkes@speakeasy.net> <20040425.181100.78702024.yoriyuki@mbg.ocn.ne.jp> <20040426101746.4a1a1fdc.ayerkes@speakeasy.net> X-Mailer: Mew version 3.3 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Miltered: at nez-perce with ID 40A8F079.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 swig:01 yamagata:01 yoriyuki:01 yoriyuki:01 yerkes:01 ayerkes:01 caml-list:01 swig:01 2004:99 bug:01 finalization:01 finalization:01 pointers:01 enum:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk From: art yerkes Subject: Re: [Caml-list] swig like library... Date: Mon, 26 Apr 2004 10:17:46 -0500 > > Please send me more details privately about the crash. That may indeed > be a bug in my module. I lost the ocaml part of the code, so I could not help. (I will rewrite everything in C) And the problem is hard to reproduce. However, I found the symptom worsens when I add a finalization function to a structure. Does swig pass a C pointer directly to a ml value, and add its own finalization function to a structure? This would corrupt the C heap, and thus explains the symptom. If any chance swig does like this, then you perhaps would want C pointers wrapped by custom blocks. > 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. Assign ids to method names (Polymorphic variant work too), and associate them to method functions by Hashtbl? The current design of "invoke" (?) does not need to change, since invoke will translate a method name to its id. Camlp4 could translate a method name to id by the compilation time as an optimization. -- Yamagata Yoriyuki ------------------- 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