caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Brian Hurt <bhurt@janestcapital.com>
To: "Hezekiah M. Carty" <hcarty@atmos.umd.edu>
Cc: caml-list <caml-list@inria.fr>
Subject: Re: [Caml-list] camlidl and 2D arrays with the [out] attribute
Date: Fri, 15 Feb 2008 15:15:06 -0500	[thread overview]
Message-ID: <47B5F2CA.6070809@janestcapital.com> (raw)
In-Reply-To: <3a360f590802151102s27f9a2f6i7d9877daa7c67249@mail.gmail.com>

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


  reply	other threads:[~2008-02-15 20:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-15 19:02 Hezekiah M. Carty
2008-02-15 20:15 ` Brian Hurt [this message]
2008-02-15 20:46   ` [Caml-list] " Hezekiah M. Carty

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=47B5F2CA.6070809@janestcapital.com \
    --to=bhurt@janestcapital.com \
    --cc=caml-list@inria.fr \
    --cc=hcarty@atmos.umd.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).