From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=AWL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id 52990BBCA for ; Fri, 15 Feb 2008 21:15:13 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAAFeBtUfAXQInh2dsb2JhbACQTgEBAQgKKZ1l X-IronPort-AV: E=Sophos;i="4.25,359,1199660400"; d="scan'208";a="22685510" Received: from concorde.inria.fr ([192.93.2.39]) by mail4-smtp-sop.national.inria.fr with ESMTP; 15 Feb 2008 21:15:13 +0100 Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id m1FKFCOp001856 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Fri, 15 Feb 2008 21:15:12 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAABuBtUdCm3xrnWdsb2JhbACQTgEBAQEBCg8InXs X-IronPort-AV: E=Sophos;i="4.25,359,1199660400"; d="scan'208";a="8141243" Received: from www.janestcapital.com (HELO smtp.janestcapital.com) ([66.155.124.107]) by mail1-smtp-roc.national.inria.fr with ESMTP; 15 Feb 2008 21:15:11 +0100 Received: from [172.25.129.161] [38.96.172.125] by janestcapital.com with ESMTP (SMTPD-9.10) id A2CE045C; Fri, 15 Feb 2008 15:15:10 -0500 Message-ID: <47B5F2CA.6070809@janestcapital.com> Date: Fri, 15 Feb 2008 15:15:06 -0500 From: Brian Hurt User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.2) Gecko/20040804 Netscape/7.2 (ax) X-Accept-Language: en-us, en MIME-Version: 1.0 To: "Hezekiah M. Carty" Cc: caml-list Subject: Re: [Caml-list] camlidl and 2D arrays with the [out] attribute References: <3a360f590802151102s27f9a2f6i7d9877daa7c67249@mail.gmail.com> In-Reply-To: <3a360f590802151102s27f9a2f6i7d9877daa7c67249@mail.gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Miltered: at concorde with ID 47B5F2D0.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; camlidl:01 arrays:01 camlidl:01 allocating:01 malloc:01 sizeof:01 pointer:01 pointer:01 bug:01 rectangular:98 wrote:01 caml-list:01 int:01 int:01 defined:02 Hezekiah M. Carty wrote: >I am attempting to use camlidl to wrap a function with the following C >prototype portion (see [1] for the full prototype): > >... void c_plriddata( ... int nptsx, ... int nptsy, [out, >size_is(nptsx,nptsy)] double ** zg ...); > >There is a lot more in the full prototype [1], but these are the >important bits for this question. In this form, the 2D zg array is >not allocated as I would have expected. Rather than allocating a >rectangular nptsx by nptsy array, the generated C is: > >zg = camlidl_malloc(nptsx * sizeof(double *), _ctx); > > > I think the problem is with your C code. zg is defined as a pointer to a pointer- not a pointer to an array! And yes, Virginia, there is a difference. If c_plriddata is accessing this pointer as a pointer to an array, you probably have a bug in your C code. Brian