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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,fbb2432d0a728c1b X-Google-Attributes: gid103376,public From: "Steve Doiel" Subject: Re: help with pointerproblem. Date: 1998/09/10 Message-ID: <35f88e65.0@news.pacifier.com>#1/1 X-Deja-AN: 389959523 References: <35f7f673.0@newsfeed.uu.se> Newsgroups: comp.lang.ada X-MimeOLE: Produced By Microsoft MimeOLE V4.71.1712.3 Date: 1998-09-10T00:00:00+00:00 List-Id: Roger Carlsson wrote in message <35f7f673.0@newsfeed.uu.se>... >Hello. > >I'm writing a program in ada95 with opengl on W95. > >I have the following definitions in GL.ads: > >type GLubyte is new C.unsigned_char; >type GLpointer is access all GLubyte; -- our substitute for "void *" > >and > >procedure (.......; x : GLpointer); > > >My own types: > >type VertexArray is array (NATURAL range <>) of aliased GLfloat; >type VertexArrayPtr is access VertexArray; > > >and in the program: >VPtr : VertexArrayPtr; >..... > >VPtr := new VertexArray(0 .. n); > > >procedure(....., GLpointer(VPtr)); > >I want to give the procedure my VertexArray as argument x. >My question is: How do i convert my VertexarrayPtr to a GLpointer? >I have tried different solutions but the compiler complains like: >Target designated type not compatible with type VertexArray. > >If i can not. Can i rewrite my own types so it works? >The VertexArray must hold GLfloat's. > You could give the following a shot. with System.Address_To_Access_Conversions; . . package ToGlPointerPackage is new System.Address_To_Access_Conversions( GLUbyte ); function ToGLpointer( vPtr : VertexArrayPtr) return GLPointer IS begin return GLPointer( ToGlPointerPackage.To_Pointer( vPtr.ALL'ADDRESS ) ); end ToGLpointer; I'm not sure about correctness, but it makes the compiler happy. I hope this helps, SteveD