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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,a4667ccac660a488 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-06-03 12:09:19 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!netnews.com!xfer02.netnews.com!newsfeed2.earthlink.net!newsfeed.earthlink.net!stamper.news.pas.earthlink.net!newsread1.prod.itd.earthlink.net.POSTED!59ce1190!not-for-mail Message-ID: <3CFBBED4.AF42C592@acm.org> From: Jeffrey Carter X-Mailer: Mozilla 4.7 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Interfaces.C.Strings References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Mon, 03 Jun 2002 19:09:15 GMT NNTP-Posting-Host: 63.184.19.202 X-Complaints-To: abuse@earthlink.net X-Trace: newsread1.prod.itd.earthlink.net 1023131355 63.184.19.202 (Mon, 03 Jun 2002 12:09:15 PDT) NNTP-Posting-Date: Mon, 03 Jun 2002 12:09:15 PDT Organization: EarthLink Inc. -- http://www.EarthLink.net Xref: archiver1.google.com comp.lang.ada:25273 Date: 2002-06-03T19:09:15+00:00 List-Id: Philippe Tarroux wrote: > > This function returns a Chars_Ptr (Char *) type which is a pointer to a > char_array supposed to be nul terminated. In the present case, this array > contains pixel values and probably several nul values. The array I get from > the Interfaces.C.Strings.Value procedure is truncated to the first nul and I > was unable to find a way to bypass this limitation. The main problem here is that "char*" means a lot of different things in C, and some of them have nothing to do with characters or strings. This function is an example of that. The return value is a pointer to an array of what are referred to in Ada as Storage_Elements (type System.Storage_Elements.Storage_Element), usually bytes, not to a NUL-terminated string. Thus, using Value is probably inappropriate, although a version of Value that takes a Length parameter may do what you want. In general, though, you might want to define a C-convention access type designating System.Storage_Elements.Storage_Array (or even better a suitably constrained subtype) and import a function returning that access type. -- Jeff Carter "Nobody expects the Spanish Inquisition!" Monty Python's Flying Circus