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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,5d708145f98f6273 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2004-04-13 10:52:04 PST Path: archiver1.google.com!news1.google.com!news.glorb.com!newsrout1.ntli.net!news.ntli.net!newspeer1-win.server.ntli.net!newsfe1-gui.server.ntli.net.POSTED!53ab2750!not-for-mail From: chris User-Agent: Mozilla Thunderbird 0.5 (X11/20040208) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Access type conversions, how? References: <107mgcjspsour11@corp.supernews.com> <407c0f2c.0@entanet> In-Reply-To: <407c0f2c.0@entanet> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Message-ID: Date: Tue, 13 Apr 2004 18:54:20 +0100 NNTP-Posting-Host: 81.107.63.68 X-Trace: newsfe1-gui.server.ntli.net 1081878622 81.107.63.68 (Tue, 13 Apr 2004 17:50:22 GMT) NNTP-Posting-Date: Tue, 13 Apr 2004 17:50:22 GMT Organization: NTL Xref: archiver1.google.com comp.lang.ada:7056 Date: 2004-04-13T18:54:20+01:00 List-Id: Luke Guest wrote: > "chris" wrote in message > news:LnTec.5$094.0@newsfe1-win... > >>type GLMatrix is array (1 .. 15) of GLFloat; >>pragma Convention(C, GLMatrix); > > No. > >>What do you want to do? Pass an array to a C function or an array of >>arrays? > > Like I said, we have a GL package which is the OpenGL bindings (yeah, all > the functions). > > I want to have an abstraction layer so I can *hide* the details of the 3D > API (or whatever I'm using on a particular platform), above my layer, > I don't want any other code to know about the lower levels, i.e. it should > not reply on GL.GLfloat, simple as that. From the code you posted it looks like a convoluted solution. Maybe it's the lack of context. I would do one of two things. Either just stick with the native GL types or make Ada ones corresponding to them and convert like this... type GLMatrix is array (1..15) of GLFloat; pragma Convention (C, GLMatrix); type OpenGLMatrix is array (1..15) of GLFloat; A : OpenGLMatrix; A (1..15) := OpenGLMatrix (SomeMatrix (1..15)); or A := OpenGLMatrix(SomeMatrix); I think i'd stick with the GL types (possibly subtyping or creating new types from them), there seems to be no gain in hiding those since they're simple and easy enough to use. subtype OpenGLMatrix is GL.GLMatrix; > But as GL bindings use the GL types, I cannot get a pointer to convert to > another pointer with the same base types. Why do that?