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,91fb0c338516ed9 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!newsread.com!news-xfer.newsread.com!news.glorb.com!newsfeed-east.nntpserver.com!nntpserver.com!manticore.nntpserver.com.POSTED!teranews!not-for-mail From: Martin Krischik Subject: Re: Getting length of array from C Newsgroups: comp.lang.ada Reply-To: martin@krischik.com References: <1107231381.627097.52490@c13g2000cwb.googlegroups.com> <1107244808.d76a000ed3c64143f06cacb757120823@teranews> <1107263868.447580.257310@z14g2000cwz.googlegroups.com> Organization: None User-Agent: KNode/0.8.0 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit NNTP-Posting-Date: Tue, 01 Feb 2005 09:30:32 EST Message-ID: <1107268232.9e156a05a25187cd83be0cd2ab74798f@teranews> X-Abuse-Report: http://www.usenetabuse.com X-Abuse-Notes: Abuse reports must be submited via the usenetabuse.com portal listed above. X-Abuse-Notes2: Reports sent via any other method will not be processed. X-Abuse-Notes3: Any other abuse reporting headers in this article are fraudulent. Date: Tue, 01 Feb 2005 15:17:19 +0100 Xref: g2news1.google.com comp.lang.ada:8113 Date: 2005-02-01T15:17:19+01:00 List-Id: Chuck wrote: > Here's the deal. I currently have some Ada code. Quite a bit of it. > The originators of the code had done some C interfacing with the Ada > code. So, I have some procedures like the following: > > procedure Write_Array( my_array : in My_Array_Type ); > pragma Import( C, Write_Array, "c_write_array" ); Well, at least GNAT is very upset if My_Array_Type is not a fixed array type. You are allowed to do it - but there is warning about the use of the dope vector. http://en.wikipedia.org/wiki/Dope_vector > The C function prototype from the header file I was given is: > void c_write_array( void *array ); That does not look right. If My_Array_Type is fixed then there should be typedef documenting that. If My_Array_Type in not fixed then indeed a length parameter is missing. > In the C code is there anyway I can get the length of the incoming > array? So, is Ada actually passing in a structure or an array? > Hope this clears things up. If My_Array_Type is fixed the the size is fixed. If My_Array_Type is not fixed then the code is broken because someone forgot to pass on the dope vector. Martin -- mailto://krischik@users.sourceforge.net http://www.ada.krischik.com