From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: [Revisited] How to get around "access type must not be outside generic unit"
Date: Wed, 24 Jan 2007 14:46:53 +0100
Date: 2007-01-24T14:46:54+01:00 [thread overview]
Message-ID: <l4kidqkua5i1.18fy2lkgpki2i.dlg@40tude.net> (raw)
In-Reply-To: 87r6tkocu4.fsf@ludovic-brenta.org
On Wed, 24 Jan 2007 12:58:59 +0100, Ludovic Brenta wrote:
> Dmitry A. Kazakov writes:
>> Let's take GtkAda as an example. The facts are:
>>
>> 1. It interfaces GTK+ (C++)
>
> No, GTK+ is written in C, even though it implements an object-oriented
> design.
Yes, or at least it has a pure C interface, no classes there.
>> 2. It is full of this
>>
>> package Glib is
>> ...
>> type Boxed_Copy is access
>> function (Boxed : System.Address) return System.Address;
>> pragma Convention (C, Boxed_Copy);
>> type Boxed_Free is access procedure (Boxed : System.Address);
>> pragma Convention (C, Boxed_Free);
>>
>> function Boxed_Type_Register_Static
>> (Name : String;
>> Copy : Boxed_Copy;
>> Free : Boxed_Free) return GType;
>>
>> How can I (well, ACT (:-)) apply Convention (C,...) on an anonymous
>> access type?!
>
> These are named access types, AFAICT.
Yes, and the first Randy's proposal was to change it to dreadful:
function Boxed_Type_Register_Static
( Name : String;
Copy : access function (Boxed : System.Address) return System.Address;
Free : access procedure (Boxed : System.Address)
);
My questions were:
1. How to apply pragma Convention on Copy and Free?
2. Why should this semantically change anything?
> GNAT implements access types with convention C as C pointers;
Sure. It would be silly to do otherwise.
> by contrast, access types with
> convention Ada may carry dope information.
If you mean that dynamic accessibility checks might help here, then I doubt
it. Boxed_Type_Register_Static is called from the body. It is too late to
check anything. If a check should fail at run-time that would be even worse
than any ugliest stuff, provided that were checked statically.
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
next prev parent reply other threads:[~2007-01-24 13:46 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-12-17 10:07 How to get around "access type must not be outside generic unit" Michael Erdmann
2006-12-17 12:45 ` Pascal Obry
2006-12-17 14:28 ` Michael Erdmann
2006-12-17 15:53 ` Pascal Obry
2006-12-17 20:49 ` Robert A Duff
2006-12-18 3:35 ` Brian May
2006-12-18 7:49 ` Jean-Pierre Rosen
2006-12-18 23:15 ` Brian May
2006-12-19 1:48 ` Randy Brukardt
2006-12-19 7:41 ` Jean-Pierre Rosen
2006-12-18 20:32 ` Michael Erdmann
2006-12-18 20:57 ` Randy Brukardt
2007-01-23 18:18 ` [Revisited] How to get around "access type must not be outside generic unit" (was: How to get around "access type must not be outside generic unit") Dmitry A. Kazakov
2007-01-24 0:57 ` Randy Brukardt
2007-01-24 11:42 ` [Revisited] How to get around "access type must not be outside generic unit" Dmitry A. Kazakov
2007-01-24 11:58 ` Ludovic Brenta
2007-01-24 13:46 ` Dmitry A. Kazakov [this message]
2007-01-24 20:50 ` Randy Brukardt
2007-01-25 11:07 ` Dmitry A. Kazakov
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox