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 UAA06686; Sat, 11 Jan 2003 20:08:35 +0100 (MET) 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 UAA06305 for ; Sat, 11 Jan 2003 20:08:33 +0100 (MET) Received: from yellow.csi.cam.ac.uk (yellow.csi.cam.ac.uk [131.111.8.67]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id h0BJ8Wr21623 for ; Sat, 11 Jan 2003 20:08:32 +0100 (MET) Received: from zone-7.jesus.cam.ac.uk ([131.111.243.37] helo=da209.jc) by yellow.csi.cam.ac.uk with esmtp (Exim 4.10) id 18XQzf-0004ao-00 for caml-list@inria.fr; Sat, 11 Jan 2003 19:08:31 +0000 From: Daniel Andor Reply-To: Daniel.Andor@physics.org To: Caml List Subject: [Caml-list] C -> CAML linking: loosing values in arrays?? Date: Sat, 11 Jan 2003 19:07:51 +0000 User-Agent: KMail/1.5 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200301111907.51989.da209@cam.ac.uk> Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Hi All, I'm trying to call a numerical routine I wrote in caml from c. I'm using the -output-obj option of ocamlopt, and have stub functions in c that convert the parameters. Since it's for numerics, I want to pass arrays of doubles. So I use make_float_array from below to convert a 4dimensional doube array into a value ready to be passed to caml. value make_float(double *d) { /* value of d intentionally ignored while we debug... */ return copy_double(0.0); } #define NUM_DIMS 4 value make_float_array(double *ds) { int i; double* p[NUM_DIMS+1]; p[NUM_DIMS]=NULL; for (i=0; i