From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,ebad38e7bffe4881 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news1.google.com!eweka.nl!lightspeed.eweka.nl!feeder.erje.net!newsfeed.straub-nv.de!nuzba.szn.dk!news.jacob-sparre.dk!pnx.dk!not-for-mail From: Kim Rostgaard Christensen Newsgroups: comp.lang.ada Subject: Re: C chars_ptr STORAGE_ERROR in Imported function Date: Sat, 23 Aug 2008 00:54:11 +0200 Organization: Jacob's private Usenet server Message-ID: References: <48ae803f$0$23588$4f793bc4@news.tdc.fi> <48aea5b7$0$25391$4f793bc4@news.tdc.fi> NNTP-Posting-Host: 1410ds1-nae.0.fullrate.dk Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: jacob-sparre.dk 1219445655 16412 90.184.228.86 (22 Aug 2008 22:54:15 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Fri, 22 Aug 2008 22:54:15 +0000 (UTC) User-Agent: Icedove 1.5.0.14eol (X11/20080724) In-Reply-To: <48aea5b7$0$25391$4f793bc4@news.tdc.fi> Xref: g2news2.google.com comp.lang.ada:7502 Date: 2008-08-23T00:54:11+02:00 List-Id: 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