comp.lang.ada
 help / color / mirror / Atom feed
From: Jeffrey Carter <spam@spam.com>
Subject: Re: Getting length of array from C
Date: Wed, 02 Feb 2005 00:15:24 GMT
Date: 2005-02-02T00:15:24+00:00	[thread overview]
Message-ID: <wYULd.3679$Nn1.684@newsread1.news.pas.earthlink.net> (raw)
In-Reply-To: <1107263868.447580.257310@z14g2000cwz.googlegroups.com>

Chuck wrote:

> procedure Write_Array( my_array : in My_Array_Type );
> pragma Import( C, Write_Array, "c_write_array" );
> 
> The C function prototype from the header file I was given is:
> void c_write_array( void *array );

There isn't enough information here to know what c_write_array is doing 
with the array. You may have to look at the body to know how to use it.

> 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.

The only way for C to know the length is to pass it as a 2nd parameter. 
Ada will pass a convention-C pointer to the array's 1st element.

-- 
Jeff Carter
"You cheesy lot of second-hand electric donkey-bottom biters."
Monty Python & the Holy Grail
14



  parent reply	other threads:[~2005-02-02  0:15 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
2005-02-01 20:07     ` Ludovic Brenta
2005-02-07  6:55       ` Dave Thompson
2005-02-02  0:15     ` Jeffrey Carter [this message]
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