From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,6b3a3c920575b35a X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!wns13feed!worldnet.att.net!attbi_s72.POSTED!53ab2750!not-for-mail From: "Jeffrey R. Carter" Organization: jrcarter at acm dot org User-Agent: Thunderbird 1.5 (Windows/20051201) MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: How to pass two dimensional arrays to C References: <1154084819.088112.325730@p79g2000cwp.googlegroups.com> In-Reply-To: <1154084819.088112.325730@p79g2000cwp.googlegroups.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: NNTP-Posting-Host: 12.201.97.176 X-Complaints-To: abuse@mchsi.com X-Trace: attbi_s72 1154117717 12.201.97.176 (Fri, 28 Jul 2006 20:15:17 GMT) NNTP-Posting-Date: Fri, 28 Jul 2006 20:15:17 GMT Date: Fri, 28 Jul 2006 20:15:17 GMT Xref: g2news2.google.com comp.lang.ada:6000 Date: 2006-07-28T20:15:17+00:00 List-Id: Jerry wrote: > In my project to write a binding for a popular plotter written in C, > I've hit a brick wall and the problem might be associated with passing > two-dimensionaal arrays to C. I'm using GNAT on OS X and Xcode. I can > pass one-dimensional arrays OK. Here are the pertinent parts from an > example where the problem happens: C doesn't have 2D arrays, as you've been told. You might try a 1D array of 1D arrays in Ada, but I suspect you're going to have to get very low level and ugly and pass a C-compatible 1D array of C-compatible pointers to C-compatible 1D arrays. You should hide this away somewhere where it will never be found by the rest of the application. -- Jeff Carter "Don't knock masturbation. It's sex with someone I love." Annie Hall 45