comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Pointer
Date: Mon, 19 May 2008 12:32:56 +0200
Date: 2008-05-19T12:32:57+02:00	[thread overview]
Message-ID: <16n2jike7ihlo.sepjog0y2f9.dlg@40tude.net> (raw)
In-Reply-To: 483152DC.4040607@gmail.com

On Mon, 19 May 2008 10:13:48 +0000, S�bastien wrote:

>> Suggesting, n is returned from the C program:
>> 
>> with Interfaces.C;  use Interfaces.C;
>> with Interfaces.C.Strings;  use Interfaces.C.Strings;
>> 
>> function Get_It return String is
>>    procedure Internal (N : out size_t; Data : out chars_ptr);
>>    pragma Import (C, Internal, "<C-name>");
>>    Data : chars_ptr;
>>    N : size_t;
>> begin
>>    Internal (Data);
>>    return Value (N, Data);
>> end Get_It;
> 
> Yes it's exaclty what I did ... and it's exaclty what I would like to 
> avoid :-) Actually, I was looking for a pure Ada solution.

In what sense pure? Do you want to re-implement Interfaces.C.String?

> I think there is a way using an unchecked type conversion, but how to be 
> sure of the size of the System.Address?

(And how to sure about the size of Character vs. char?)

You could convert System.Address to a pointer of an Ada object using an
instance of System.Address_To_Access_Conversions.

(It seems that I don't fully understand your problem)

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



  reply	other threads:[~2008-05-19 10:32 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-19  9:38 Pointer Sébastien
2008-05-19  9:53 ` Pointer Dmitry A. Kazakov
2008-05-19  9:54   ` Pointer Dmitry A. Kazakov
2008-05-19 10:13   ` Pointer Sébastien
2008-05-19 10:32     ` Dmitry A. Kazakov [this message]
2008-05-19 10:34     ` Pointer Ludovic Brenta
2008-05-19 11:31       ` Pointer Sébastien
2008-05-19 12:09         ` Pointer Ludovic Brenta
2008-05-19 12:09         ` Pointer Dmitry A. Kazakov
2008-05-19 12:47           ` Pointer Sébastien
2008-05-19 16:25         ` Pointer Matthew Heaney
2008-05-19 16:22     ` Pointer Matthew Heaney
2008-05-19 16:17 ` Pointer Matthew Heaney
2008-05-19 17:23   ` Pointer Sébastien
  -- strict thread matches above, loose matches on Subject: below --
2005-08-31 17:02 pointer TC
2005-08-31 18:40 ` pointer Martin Krischik
2005-08-31 18:52 ` pointer Jeffrey Carter
replies disabled

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