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,91fb0c338516ed9 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!proxad.net!proxad.net!194.159.246.34.MISMATCH!peer-uk.news.demon.net!kibo.news.demon.net!mutlu.news.demon.net!news.demon.co.uk!demon!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: Getting length of array from C Date: 01 Feb 2005 05:26:00 +0000 Organization: Pushface Sender: simon@smaug.pushface.org Message-ID: References: <1107231381.627097.52490@c13g2000cwb.googlegroups.com> NNTP-Posting-Host: pogner.demon.co.uk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: news.demon.co.uk 1107235617 20287 62.49.19.209 (1 Feb 2005 05:26:57 GMT) X-Complaints-To: abuse@demon.net NNTP-Posting-Date: Tue, 1 Feb 2005 05:26:57 +0000 (UTC) User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1 Xref: g2news1.google.com comp.lang.ada:8101 Date: 2005-02-01T05:26:00+00:00 List-Id: "Chuck" writes: > Is there some way of getting an ada array length from C interface > code? I have to try and accomplish this while minimizing the number > of changes to the original Ada code. Any ideas? Afraid I can't tell which way round you want this to work! Do you have an Ada array that you need C code to be able to get at, or a C array that you need Ada code to be able to get at? What's the concept of operation? Typically C code needs/can provide the address of the first element of the array and a count of the number of elements. Depending on your compiler, you may find something like procedure C_Proc (A : My_Array; Count : Integer); pragma Import (C, C_Proc, "c_proc"); helpful. You might need to declare a derived array type to get the representation to be compatible: type My_C_Array is new My_Array; pragma Convention (C, My_C_Array); -- Simon Wright 100% Ada, no bugs.