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,start X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!postnews.google.com!p79g2000cwp.googlegroups.com!not-for-mail From: "Jerry" Newsgroups: comp.lang.ada Subject: How to pass two dimensional arrays to C Date: 28 Jul 2006 04:06:59 -0700 Organization: http://groups.google.com Message-ID: <1154084819.088112.325730@p79g2000cwp.googlegroups.com> NNTP-Posting-Host: 71.35.35.3 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1154084824 15200 127.0.0.1 (28 Jul 2006 11:07:04 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 28 Jul 2006 11:07:04 +0000 (UTC) User-Agent: G2/0.2 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322),gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: p79g2000cwp.googlegroups.com; posting-host=71.35.35.3; posting-account=Ax24hA0AAABV39UFqUVhb0kauOuAbI3T Xref: g2news2.google.com comp.lang.ada:5987 Date: 2006-07-28T04:06:59-07:00 List-Id: 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: The C typedef double PLFLT; typedef int PLINT; void c_plmesh(PLFLT *x, PLFLT *y, PLFLT **z, PLINT nx, PLINT ny, PLINT opt); The Ada type Long_Float_Array_1D is array (Integer range <>) of Long_Float; type Long_Float_Array_2D is array (Integer range <>, integer range <>) of Long_Float; subtype PLINT is Integer; subtype PL_Float_Array is Long_Float_Array_1D; subtype PL_Float_Array_2D is Long_Float_Array_2D; procedure plmesh( x : PL_Float_Array; y : PL_Float_Array; z : PL_Float_Array_2D; nx : PLINT; ny : PLINT; opt : PLINT); pragma Import(C, plmesh, "c_plmesh"); And the Ugly AdaPLplotProject has exited due to signal 11 (SIGSEGV). This appears during the call to plmesh. Any ideas? Thanks, Jerry