comp.lang.ada
 help / color / mirror / Atom feed
From: Mats Weber <Mats.Weber@elca-matrix.ch>
Subject: Re: help with pointerproblem.
Date: 1998/09/11
Date: 1998-09-11T00:00:00+00:00	[thread overview]
Message-ID: <35F92121.7C105BD4@elca-matrix.ch> (raw)
In-Reply-To: 35f7f673.0@newsfeed.uu.se

Roger Carlsson wrote:
 
> 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 *"

The substibute for void * in Ada is called System.Address.

Just write your C subporgrams in Ada with System.Address as parameters, e.g:

   function example (X : System.Address) return Interfaces.C.Int;

   pragma Import (C, example);

   ...

   Z : VertexArray(...);

   Result := example(Z'Address);

I have always done it this way and it works great will all compilers I have used.

Another approach is using access parameters (you get better type checking this
way) but I'll let someone else decribe that (I have never used it myself).




      parent reply	other threads:[~1998-09-11  0:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-09-10  0:00 help with pointerproblem Roger Carlsson
1998-09-10  0:00 ` Steve Doiel
1998-09-11  0:00   ` Wayne Magor
1998-09-11  0:00     ` Mats Weber
1998-09-12  0:00     ` dewarr
1998-09-17  0:00       ` Matthew Heaney
1998-09-11  0:00 ` Mats Weber [this message]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox