comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Ada to C interfacing with access on unconstrained array
Date: Tue, 20 Oct 2009 18:11:15 +0200
Date: 2009-10-20T18:11:11+02:00	[thread overview]
Message-ID: <1pe7su4hhh3ul.t10o4zs4n5i2.dlg@40tude.net> (raw)
In-Reply-To: 2ec52d54-31f6-4289-9a9a-d947be65758c@o21g2000vbl.googlegroups.com

On Tue, 20 Oct 2009 06:07:18 -0700 (PDT), dhenry wrote:

> I am trying to interface C with Ada: I want to call an Ada procedure
> from C.

When you pass a pointer to a C array to Ada you have to copy all elements
of the array when the types are not compatible, as they are according to
what you wrote. Therefore your interface must copy/marshal the parameters,
sorry.

The best thing you could do is to avoid pool memory allocation.

BTW, why

   type Coco_Type is record
      X : Integer;
      Y : Integer;
      Nuts : Nut_Array_Access;
   end record;

and not

   type Coco_Type (Size : Natural) is record
      X : Integer;
      Y : Integer;
      Nuts : Nut_Array_Type (1..Size);
   end record;

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



  reply	other threads:[~2009-10-20 16:11 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-20 13:07 Ada to C interfacing with access on unconstrained array dhenry
2009-10-20 16:11 ` Dmitry A. Kazakov [this message]
2009-10-21  9:25   ` dhenry
2009-10-21 12:09     ` Dmitry A. Kazakov
2009-10-21 12:14       ` Dmitry A. Kazakov
2009-10-20 16:24 ` Adam Beneschan
2009-10-20 18:40 ` tmoran
2009-10-21  3:29   ` John B. Matthews
2009-10-21  9:29     ` dhenry
2009-10-21 14:16       ` John B. Matthews
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox