From: Yves Bailly <kafka.fr@laposte.net>
Subject: Re: How to use Annex G.3 Vectors and Matrices in bindings to C arrays
Date: Mon, 13 Nov 2006 18:42:56 +0100
Date: 2006-11-13T18:44:10+01:00 [thread overview]
Message-ID: <4558aeea$0$20297$426a74cc@news.free.fr> (raw)
In-Reply-To: 1163416802.221321.170270@f16g2000cwb.googlegroups.com
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 | //\
\_/ | | \_/`
next prev parent reply other threads:[~2006-11-13 17:42 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-11-12 3:45 How to use Annex G.3 Vectors and Matrices in bindings to C arrays Jerry
2006-11-12 8:45 ` Yves Bailly
2006-11-13 10:48 ` Jerry
2006-11-12 19:39 ` Jeffrey R. Carter
2006-11-13 7:09 ` tmoran
2006-11-13 11:20 ` Jerry
2006-11-13 17:42 ` Yves Bailly [this message]
2006-11-13 19:50 ` Gautier
2006-11-14 5:28 ` Jerry
2006-11-14 5:18 ` Jerry
2006-11-13 19:09 ` Jeffrey R. Carter
2006-11-14 7:31 ` Jerry
2006-11-14 7:54 ` Jerry
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox