From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.6.10/8.6.6) id JAA13833 for caml-redistribution; Wed, 25 Sep 1996 09:45:34 +0200 Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.6.10/8.6.6) with ESMTP id TAA02814 for ; Tue, 24 Sep 1996 19:11:05 +0200 Received: from nef.ens.fr (nef.ens.fr [129.199.96.12]) by concorde.inria.fr (8.7.6/8.7.1) with SMTP id TAA17351 for ; Tue, 24 Sep 1996 19:11:04 +0200 (MET DST) Received: from vedette.ens.fr by nef.ens.fr (5.65c8/ULM-1.0) Id AA06278 ; Tue, 24 Sep 1996 19:11:02 +0200 Date: Tue, 24 Sep 1996 19:11:01 +0200 (MET DST) From: Jerome Vouillon Subject: Re: Need help: O'Caml C Interface To: Juan Jose Quintela Carreira Cc: caml-list@pauillac.inria.fr, christo@nextsolution.co.jp In-Reply-To: <9609241445.AA10783@dc.fi.udc.es> Message-Id: Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: weis > If you changes the lines: > > > > value ocaml_getCharWidth(value code) > > { > > double x, y; > > Push_roots(r,1); > > > > r[0] = alloc_tuple(2); > > getCharWidth(Int_val(code),&x,&y); > - Store_double_val(Field(r[0],0),x); > + modify(&Field(r[0],0),copy_double(x); /* Field(r[0],0)=copy_double(x)*/ > - Store_double_val(Field(r[0],1),y); > + modify(&Field(r[0],1),copy_double(y); /* Field(r[0],1)=copy_double(y)*/ > > Pop_roots(); > > return r[0]; > > } > > > > The coment sentences also work in this example, but the former work always, Well, actually neither are correct, as copy_double allocate some memory. Thus, the tuple should have been filled with dummy values prior to the first call to copy_double, and one cannot use `Field(..) = ..'. Jerome