comp.lang.ada
 help / color / mirror / Atom feed
From: chris <spamoff.danx@ntlworld.com>
Subject: Re: generic imports?  void* -> generics?
Date: Sat, 20 Sep 2003 00:01:36 +0100
Date: 2003-09-20T00:01:36+01:00	[thread overview]
Message-ID: <7RLab.3789$I9.2507@newsfep4-winn.server.ntli.net> (raw)
In-Reply-To: <uwuc4mmeo.fsf@earthlink.net>

Matthew Heaney wrote:

> There's no binding to C type void* in Interfaces.C, but type
> System.Address should work OK.  That way you can say:

That was what I was going to do (did that in the past), but I wondered 
if there was a safer way.  I might go with it as it's simple enough to 
implement.


> This is wrong, because your Ada function to_userdata returns an object,
> not a pointer to object, as the C function does.  You need to bind to an
> access type, like this:

I changed it to use an access type in the spec, but the problem was the 
compiler rejected any attempt in the spec to specify the convention of a 
generic type.


>    function To_Userdata
>      (L : lua_state_access;
>       Pos : Index) return Userdata is
> 

snip

>       Result : constant Userdata_Access :=
>          lua_touserdata(L, Pos);
>    begin
>       return Result.all;
>    end;

Never thought of that, thanks.


Thanks,
Chris




  reply	other threads:[~2003-09-19 23:01 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-09-19 19:20 generic imports? void* -> generics? chris
2003-09-19 20:46 ` chris
2003-09-19 21:18 ` Nick Roberts
2003-09-19 23:12   ` chris
2003-09-20 16:52   ` Simon Wright
2003-09-22 21:30     ` Randy Brukardt
2003-09-23  5:45       ` Simon Wright
2003-09-23 19:07         ` Randy Brukardt
2003-09-23 20:28           ` Simon Wright
2003-09-24 18:16             ` Randy Brukardt
2003-09-19 22:40 ` Matthew Heaney
2003-09-19 23:01   ` chris [this message]
2003-09-20  1:59   ` Jeffrey Carter
2003-09-20 13:52     ` Matthew Heaney
2003-09-23 22:39 ` chris
replies disabled

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