comp.lang.ada
 help / color / mirror / Atom feed
From: Gautier <gautier@fakeaddress.nil>
Subject: Re: How to use Annex G.3 Vectors and Matrices in bindings to C arrays
Date: Mon, 13 Nov 2006 20:50:30 +0100
Date: 2006-11-13T20:50:30+01:00	[thread overview]
Message-ID: <4558cc70$1_4@news.bluewin.ch> (raw)
In-Reply-To: <4558aeea$0$20297$426a74cc@news.free.fr>

Yves Bailly:

> 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).

This is at least mentioned in the B.1 annex (verse 2), with exactly the 
example of a nD array's storage.

BTW, in my OpenGL code (GLOBE_3D.Math, body) there is...

   type Matrix_44 is array(0..3,0..3) of aliased Real; -- for GL.MultMatrix
   pragma Convention(Fortran, Matrix_44);  -- GL stores matrices columnwise

HTH, Gautier
______________________________________________________________
Ada programming -- http://www.mysunrise.ch/users/gdm/gsoft.htm

NB: For a direct answer, e-mail address on the Web site!



  reply	other threads:[~2006-11-13 19:50 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
2006-11-13 19:50       ` Gautier [this message]
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