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 CAA12643; Sun, 12 Jan 2003 02:03:19 +0100 (MET) 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 CAA12831 for ; Sun, 12 Jan 2003 02:03:18 +0100 (MET) Received: from red.csi.cam.ac.uk (red.csi.cam.ac.uk [131.111.8.70]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id h0C13H524023 for ; Sun, 12 Jan 2003 02:03:17 +0100 (MET) Received: from zone-7.jesus.cam.ac.uk ([131.111.243.37] helo=da209.jc) by red.csi.cam.ac.uk with esmtp (Exim 4.10) id 18XWWu-0002CF-00; Sun, 12 Jan 2003 01:03:12 +0000 From: Daniel Andor Reply-To: Daniel.Andor@physics.org To: Artem Prisyznuk Subject: Re: [Caml-list] C -> CAML linking: loosing values in arrays?? Date: Sun, 12 Jan 2003 01:02:30 +0000 User-Agent: KMail/1.5 Cc: Caml List References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200301120102.30308.da209@cam.ac.uk> Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Thanks to you and Basile, who also replied. I think I now understand that I need to use the more low-level alloc() function with the appropriate tag, since there doesn't seem to be a version of alloc_array() suitable for doubles. At the moment my main worry is that I'm allocating new arrays to pass to the function faster than the gc can clean them up... I need to find out about hanging on to allocated values on the C side of things. Thanks, Daniel. On Saturday 11 January 2003 11:20 pm, Artem Prisyznuk wrote: > 11.01.03 22:07:51, Daniel Andor wrote: > >If I pass a non-array double using copy_double(), it works and I get the > >correct number on the other side. > > > >Any ideas as to where I've gone wrong? > > From Caml manual: > > .... > 18.3.3 > Arrays > > Arrays of integers and pointers are represented like tuples, that is, as > pointers to blocks tagged 0. They are accessed with the Field macro for > reading and the modify function for writing. > > Arrays of floating-point numbers (type float array) have a _special, > unboxed_, more efficient representation. These arrays are represented by > pointers to blocks with tag Double_array_tag. They should be accessed with > the Double_field and Store_double_field macros. .... > > >Thanks, > >Daniel. > >------------------- > >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 > > ------------------- > 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 ------------------- 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