From: Martin Krischik <martin@krischik.com>
Subject: Re: Getting length of array from C
Date: Tue, 01 Feb 2005 15:17:19 +0100
Date: 2005-02-01T15:17:19+01:00 [thread overview]
Message-ID: <1107268232.9e156a05a25187cd83be0cd2ab74798f@teranews> (raw)
In-Reply-To: 1107263868.447580.257310@z14g2000cwz.googlegroups.com
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
next prev parent reply other threads:[~2005-02-01 14:17 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-02-01 4:16 Getting length of array from C Chuck
2005-02-01 5:26 ` Simon Wright
2005-02-01 7:25 ` Martin Krischik
2005-02-01 13:17 ` Chuck
2005-02-01 14:17 ` Martin Krischik [this message]
2005-02-01 20:07 ` Ludovic Brenta
2005-02-07 6:55 ` Dave Thompson
2005-02-02 0:15 ` Jeffrey Carter
2005-02-02 2:22 ` Steve
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox