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,463c5796782db6d8 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-04-09 10:42:51 PST Path: archiver1.google.com!postnews1.google.com!not-for-mail From: mheaney@on2.com (Matthew Heaney) Newsgroups: comp.lang.ada Subject: Re: [Spark] Arrays of Strings Date: 9 Apr 2003 10:42:50 -0700 Organization: http://groups.google.com/ Message-ID: <1ec946d1.0304090942.3106b4e4@posting.google.com> References: NNTP-Posting-Host: 66.162.65.162 Content-Type: text/plain; charset=ISO-8859-2 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1049910171 13102 127.0.0.1 (9 Apr 2003 17:42:51 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: 9 Apr 2003 17:42:51 GMT Xref: archiver1.google.com comp.lang.ada:36026 Date: 2003-04-09T17:42:51+00:00 List-Id: Lutz Donnerhacke wrote in message news:... > In order to implement thin an execve binding, I wonder how to emulate the > C-Type "char const * const x []". Any bright ideas? Realize that an array in C "decays" to a pointer to the first element, so x has the type const char* const* If you want to use the char* type in Interfaces.C.Strings, then your problem reduces to: type chars_ptr_access is access constant C.Strings.chars_ptr; for chars_ptr_access'Storage_Size use 0; pragma Convention (C, chars_ptr_access); Now just declare an array of aliased chars_ptr, e.g. type chars_ptr_array is (Natural range <>) of aliased chars_ptr; pragma Convention (C, chars_ptr_array); argv_array : constant chars_ptr_array := ...; argv_ptr : constant chars_ptr_access := argv_array (0)'Access; execv(filename, argv_ptr); Interestingly, the chars_ptr_array declared in RM95 B.3.1 (6) does not declare its component subtype as aliased, nor is the array marked as begin C-compatible. This seems wrong to me, which is why I declared the chars_ptr_array type myself, as above.