comp.lang.ada
 help / color / mirror / Atom feed
From: Martin Krischik <martin@krischik.com>
Subject: Re: Getting length of array from C
Date: Tue, 01 Feb 2005 08:25:25 +0100
Date: 2005-02-01T08:25:25+01:00	[thread overview]
Message-ID: <1107244808.d76a000ed3c64143f06cacb757120823@teranews> (raw)
In-Reply-To: 1107231381.627097.52490@c13g2000cwb.googlegroups.com

Chuck wrote:

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

I did a lot of C interfacing and there are quite a few option open. Usualy
you need two parameters one for the array one for the size.

A very interesting hint - if you declare the following type inside a
procedure:

  type C_Array is array 0 .. Number - 1 of Interfaces.C.int;

then Number does not need to a constant. And of course the other way around
as well:

  type Ada_Array is array 1 .. Number of Integer;


Martin

-- 
mailto://krischik@users.sourceforge.net
http://www.ada.krischik.com



  parent reply	other threads:[~2005-02-01  7:25 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 [this message]
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
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