comp.lang.ada
 help / color / mirror / Atom feed
From: Kim Rostgaard Christensen <krc@greenpc.dk>
Subject: Re: C chars_ptr STORAGE_ERROR in Imported function
Date: Sat, 23 Aug 2008 00:54:11 +0200
Date: 2008-08-23T00:54:11+02:00	[thread overview]
Message-ID: <g8ng2n$g0s$1@jacob-sparre.dk> (raw)
In-Reply-To: <48aea5b7$0$25391$4f793bc4@news.tdc.fi>

Niklas Holsti wrote:
...
> I think it would be better to use the To_Chars_Ptr function, which makes 
> a chars_ptr that points to Errbuf itself, without allocating another 
> char_array, so there is no need to Free anything. This also needs a 
> change in the declaration of Errbuf:
> 
>    Errbuf : aliased Char_Array := (1 .. 256 => Interfaces.C.nul);
> 
...
>    Errbuf_Ptr := To_Chars_Ptr (Errbuf'Unchecked_Access, False);
> 
> followed by:
> 
>>       Device := pcap_lookupdev(Errbuf_ptr);
> 
...
> HTH
> 

This works like a charm, thanks a lot.

KRC



  reply	other threads:[~2008-08-22 22:54 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-22  8:36 C chars_ptr STORAGE_ERROR in Imported function Kim Rostgaard Christensen
2008-08-22  9:03 ` Niklas Holsti
2008-08-22  9:55   ` Kim Rostgaard Christensen
2008-08-22 11:43     ` Niklas Holsti
2008-08-22 22:54       ` Kim Rostgaard Christensen [this message]
2008-08-22 18:48 ` anon
2008-08-22 21:55   ` tmoran
2008-08-23 10:11   ` Niklas Holsti
replies disabled

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