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: g2news1.google.com!news2.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!newsfeed.freenet.de!news-out1.kabelfoon.nl!newsfeed.kabelfoon.nl!bandi.nntp.kabelfoon.nl!news.banetele.no!uio.no!fi.sn.net!newsfeed1.fi.sn.net!news.song.fi!not-for-mail Date: Fri, 22 Aug 2008 12:03:24 +0300 From: Niklas Holsti User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20060628 Debian/1.7.8-1sarge7.1 X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: C chars_ptr STORAGE_ERROR in Imported function References: In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Message-ID: <48ae803f$0$23588$4f793bc4@news.tdc.fi> Organization: TDC Internet Services NNTP-Posting-Host: laku61.adsl.netsonic.fi X-Trace: 1219395647 news.tdc.fi 23588 81.17.205.61:32857 X-Complaints-To: abuse@tdcnet.fi Xref: g2news1.google.com comp.lang.ada:1753 Date: 2008-08-22T12:03:24+03:00 List-Id: Kim Rostgaard Christensen wrote: > Hello there > > I am in progress of binding the pcap c library to ada, it is a part of a > school project. And for that i need a funtion that modifies a parameter > to a function like so: > > char *pcap_lookupdev(char *); > ... > > Do I need to declare the buffer and then then pass its c pointer to the > function? That is certainly my interpretation of the "man" text: char *pcap_lookupdev(char *errbuf) pcap_lookupdev() returns a pointer to a network device suitable for use with pcap_open_live() and pcap_lookupnet(). If there is an error, NULL is returned and errbuf is filled in with an appropriate error message. There is no hint that pcap_lookupdev() itself allocates the errbuf; it just puts something in the caller-provided errbuf. And no doubt places a NUL terminator after the message. HTH -- Niklas Holsti Tidorum Ltd niklas holsti tidorum fi . @ .