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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,3332d83c4f455808 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news4.google.com!news2.volia.net!newsfeed01.sul.t-online.de!newsfeed00.sul.t-online.de!t-online.de!nntp.theplanet.net!inewsm1.nntp.theplanet.net!pe2.news.blueyonder.co.uk!blueyonder!proxad.net!cleanfeed2-a.proxad.net!nnrp4-1.free.fr!not-for-mail Message-ID: <4558aeea$0$20297$426a74cc@news.free.fr> From: Yves Bailly Subject: Re: How to use Annex G.3 Vectors and Matrices in bindings to C arrays Newsgroups: comp.lang.ada Date: Mon, 13 Nov 2006 18:42:56 +0100 References: <1163303134.998680.268570@h54g2000cwb.googlegroups.com> <1163416802.221321.170270@f16g2000cwb.googlegroups.com> User-Agent: KNode/0.10.4 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit Organization: Guest of ProXad - France NNTP-Posting-Date: 13 Nov 2006 18:44:10 MET NNTP-Posting-Host: 81.56.171.53 X-Trace: 1163439850 news-2.free.fr 20297 81.56.171.53:49845 X-Complaints-To: abuse@proxad.net Xref: g2news2.google.com comp.lang.ada:7429 Date: 2006-11-13T18:44:10+01:00 List-Id: Jerry wrote: > Jeffrey R. Carter wrote: >> Jerry wrote: >> > >> > I wonder if I am incorrect in believing that the binding to C-arrays >> > need aliased components. Like I said, the reason for that is a little >> > fuzzy to me right now. But I do know that if I remove the aliased >> > component requirement from Long_Float_Array_1D the binding will not >> > compile. >> >> What is the error message that you get? Are you taking 'access of >> components of such arrays? >> > I'm afraid I'll have to apologize for not being accurate in my initial > post. Indeed, I am not having any problems (as I erroneously claimed) > with 1D arrays. The problem arises with 2D arrays, about which I > pestered the list earlier. With further apologies for posting a bit > more code that I would like, the following is a typical binding that I > made in which it was necessary to gain access to 2D C arrays. As far as I know, nD arrays (n > 1) in Ada are very different things than nD arrays in C. Basically, a 2D array in C is an array of arrays, but this is not the case in Ada (it *might* be the case, but I guess it's compiler- dependant). So I'm not sure if it's actually possible to correctly pass nD arrays to C code... Back again to my OpenGL code, I did things like this: type Vector is array(1..3) of Float; pragma Convention(C, Vector); type Matrix is array(1..3) of Vector; pragma Convention(C, Matrix); ...and it worked quite well. But maybe this pragma works for nD arrays? I'm quite interested in the answer (I'll test this as soon as I have some time). Regards, -- (o< | Yves Bailly : http://kafka-fr.net | -o) //\ | Linux Dijon : http://www.coagul.org | //\ \_/ | | \_/`