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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,e940dc253695e939 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!news1.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!news.belwue.de!newsfeed.arcor.de!newsspool1.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Pointer Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: Date: Mon, 19 May 2008 11:53:11 +0200 Message-ID: <2rjq6ys3fang$.1ir8q3892mjwo$.dlg@40tude.net> NNTP-Posting-Date: 19 May 2008 11:53:11 CEST NNTP-Posting-Host: 24c471f6.newsspool4.arcor-online.net X-Trace: DXC=YEVWPVHCBIgfF8a^:6>b7e4IUKoM>c3IomcM`a X-Complaints-To: usenet-abuse@arcor.de Xref: g2news1.google.com comp.lang.ada:229 Date: 2008-05-19T11:53:11+02:00 List-Id: On Mon, 19 May 2008 09:38:08 +0000, S�bastien wrote: > I'm getting from a C interfaces a char**data in a System.Address. I have > the following hypothesis: > - data is an array of n elements where n is known > - There is no memory issue (meaning data[i] with i < n is allocated) > - I do not have to free the memory (memory is managed by the C library) > > How can I retrieve all my values in the C arrays using a loop to create > some Ada String (Interfaces.C.Strings.Value)? 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, ""); Data : chars_ptr; N : size_t; begin Internal (Data); return Value (N, Data); end Get_It; -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de