From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: calling ada from c with an array param
Date: Mon, 21 Sep 2009 10:08:51 +0200
Date: 2009-09-21T10:08:52+02:00 [thread overview]
Message-ID: <vsyizsxlej4$.bgdu7mys7ljj$.dlg@40tude.net> (raw)
In-Reply-To: 19zw9zf5j7p5b.vpt4c3xvlsaa.dlg@40tude.net
On Mon, 21 Sep 2009 10:04:58 +0200, Dmitry A. Kazakov wrote:
> 2. Here is a variant based on flat arrays:
> --------- conjunc.ads --------------------
> with Interfaces.C; use Interfaces.C;
>
> package conjunc is
> type C_Float_Array is array (int range <>) of aliased C_Float;
I forgot to add this:
pragma Convention (C, C_Float_Array);
> subtype Flat_C_Float_Array is C_Float_Array (1..int'Last);
> procedure conj (A : in out Flat_C_Float_Array; Len: int);
> pragma Export (C, conj, "conjunc");
> end conjunc;
> --------- conjunc.adb --------------------
> package body conjunc is
> procedure conj (A : in out Flat_C_Float_Array; Len: int) is
> begin
> A (1) := 99.0;
> A (2) := 100.0;
> A (3) := 101.0;
> A (4) := 102.0;
> end conj;
> end conjunc;
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
next prev parent reply other threads:[~2009-09-21 8:08 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-20 19:38 calling ada from c with an array param Mike
2009-09-20 19:59 ` Jan Andres
2009-09-21 8:04 ` Dmitry A. Kazakov
2009-09-21 8:08 ` Dmitry A. Kazakov [this message]
2009-09-21 17:29 ` Jeffrey R. Carter
2009-09-21 19:58 ` sjw
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox