comp.lang.ada
 help / color / mirror / Atom feed
From: "Jeffrey R. Carter" <spam.jrcarter.not@spam.not.acm.org>
Subject: Re: Help with PLplot bindings: How to pass a record of function pointers to a procedure
Date: Wed, 13 Apr 2016 09:43:55 -0700
Date: 2016-04-13T09:43:55-07:00	[thread overview]
Message-ID: <nelsq3$9kq$1@dont-email.me> (raw)
In-Reply-To: <bce29636-6148-4efa-a6d6-ca683e8cb74f@googlegroups.com>

On 04/13/2016 03:01 AM, Jerry wrote:
>
> type Function_To_Manipulate_Matrix_A_Type is
>      access function (p : Real_Matrix; ix, iy : Integer)
>          return Long_Float;
> type Function_To_Manipulate_Matrix_B_Type is
>      access function (p : in out Real_Matrix; ix, iy : Integer; z : Long_Float)
>          return Long_Float;
>
> type PLf2ops_Type is
>      record
>          Get    : Function_To_Manipulate_Matrix_A_Type;
>          Set    : Function_To_Manipulate_Matrix_B_Type;
>      end record;
>
> function plf2ops_c_get(p : Real_Matrix; ix, iy : Integer) return Long_Float;
> pragma Import(C, plf2ops_c_get, "plf2ops_c_get");
>
> function plf2ops_c_set(p : Real_Matrix; ix, iy : Integer; z : Long_Float) return Long_Float;
> pragma Import(C, plf2ops_c_set, "plf2ops_c_set");
>
> s_plf2ops_c : PLf2ops_Type :=
>     (Get => plf2ops_c_get(p : Real_Matrix; ix, iy : Integer),
>      Set => plf2ops_c_set(p : Real_Matrix; ix, iy : Integer; z : Long_Float));

Only addressing this part, type PLf2ops_Type has 2 components, both of which are 
of access types. A value (aggregate) of this type must therefore contain 2 
access values. I suspect you want

S_Plf2ops_C : Plf2ops_Type :=
    (Get => Plf2ops_C_Get'Access, Set => Plf2ops_C_Set'Access);

Depending on what you're doing with them, you might want the access types and 
the record type declared Convention C.

-- 
Jeff Carter
"Violence is the last refuge of the incompetent."
Foundation
151

  reply	other threads:[~2016-04-13 16:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-13 10:01 Help with PLplot bindings: How to pass a record of function pointers to a procedure Jerry
2016-04-13 16:43 ` Jeffrey R. Carter [this message]
2016-04-15  8:08   ` Jerry
replies disabled

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