From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: "Jeffrey R. Carter" Newsgroups: comp.lang.ada 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 Organization: Also freenews.netfront.net; news.tornevall.net; news.eternal-september.org Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Wed, 13 Apr 2016 16:40:37 -0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="48b46be33beed75863f69afa437f956b"; logging-data="9882"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18R/ePNc7ZUgtXMz12yIjghWsy4HING/e4=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 In-Reply-To: Cancel-Lock: sha1:U5DX6KMk7xEwQtDBbHjQFgTK8Mw= Xref: news.eternal-september.org comp.lang.ada:30099 Date: 2016-04-13T09:43:55-07:00 List-Id: 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