comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: How to access this package written in C?
Date: Tue, 27 Apr 2010 17:29:14 -0500
Date: 2010-04-27T17:29:14-05:00	[thread overview]
Message-ID: <hr7ofq$e2$1@munin.nbi.dk> (raw)
In-Reply-To: hr61dn$fsh$1@news.eternal-september.org

...
>> I use this:
>>
>>     subtype Void_Ptr is System.Address;
>
> I have sometimes used
>
>      type Void is null record;
>      pragma Convention (Void, C);
>      type Void_Ptr is access all Void;
>      pragma Convention (Void_Ptr, C);

Most of the time, I've avoided any version of void* and simply written 
overloadings for each type that I needed (using in out parameters if 
possible, or access parameters if I needed the function result). That only 
works of course when the number of types that you need is limited, and it's 
not as flexible as some more direct mapping.

But void* is exactly the opposite of strong typing, and it simply doesn't 
fit well into the Ada type model. So avoiding it if possible is the best 
approach.

                        Randy.








  reply	other threads:[~2010-04-27 22:29 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-21 16:43 How to access this package written in C? resander
2010-04-21 17:39 ` Dmitry A. Kazakov
2010-04-22 20:12 ` Björn Persson
2010-04-22 21:12 ` Keith Thompson
2010-04-23 12:58   ` resander
2010-04-23 14:15     ` Dmitry A. Kazakov
2010-04-23 14:44     ` John B. Matthews
2010-04-23 15:39       ` John B. Matthews
2010-04-26 18:16     ` Robert A Duff
2010-04-26 19:57       ` Keith Thompson
2010-04-26 21:20         ` Maciej Sobczak
2010-04-27  6:52           ` Alex R. Mosteo
2010-04-27 22:29             ` Randy Brukardt [this message]
2010-05-03  8:12               ` Alex R. Mosteo
2010-04-27  0:20         ` Robert A Duff
2010-04-27  1:01           ` Keith Thompson
2010-04-27 16:07             ` Robert A Duff
2010-04-27 22:29               ` Randy Brukardt
2010-04-27  1:31           ` Randy Brukardt
replies disabled

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