From: "Jeffrey R. Carter" <spam.jrcarter.not@spam.not.acm.org>
Subject: Re: Interfaces.C questions
Date: Sat, 18 Mar 2017 17:26:04 +0100
Date: 2017-03-18T17:26:04+01:00 [thread overview]
Message-ID: <oajn1p$oku$1@dont-email.me> (raw)
In-Reply-To: <ej5333FimjaU1@mid.individual.net>
On 03/18/2017 04:46 PM, hreba wrote:
>
> struct gsl_function_struct
> {
> double (* function) (double x, void * params);
> void * params;
> };
> typedef struct gsl_function_struct gsl_function ;
>
> Can anybody please tell me how to translate this into Ada? I have no idea how to
> handle the void pointers.
Presuming that this is C's equivalent of a private type, and all allocation will
be handled by the library, then the equivalent of void* is any convention-C
access type. I'd probably write
type Void_Ptr is access all Integer;
pragma Convention (C, Void_Ptr);
type GSL_Function_Ptr is access
function (X : Interfaces.C.Double; Params : Void_Ptr)
return Interfaces.C.Double;
pragma Convention (C, GSL_Function_Ptr);
type GSL_Function is record
Func : GSL_Function_Ptr;
Params : Void_Ptr;
end record;
pragma Convention (C, GSL_Function);
--
Jeff Carter
"Pray that there's intelligent life somewhere up in
space, 'cause there's bugger all down here on earth."
Monty Python's Meaning of Life
61
next prev parent reply other threads:[~2017-03-18 16:26 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-17 21:12 Interfaces.C questions hreba
2017-03-17 21:57 ` Niklas Holsti
2017-03-17 22:14 ` Jeffrey R. Carter
2017-03-17 22:24 ` Dmitry A. Kazakov
2017-03-21 21:08 ` Michael B.
2017-03-21 21:28 ` Dmitry A. Kazakov
2017-03-21 21:31 ` Simon Wright
2017-03-22 20:35 ` Randy Brukardt
2017-03-18 15:46 ` hreba
2017-03-18 16:26 ` Jeffrey R. Carter [this message]
2017-03-18 16:27 ` Jeffrey R. Carter
2017-03-19 7:03 ` Keith Thompson
2017-03-18 23:24 ` Leo Brewin
2017-03-19 12:17 ` hreba
2017-03-20 9:44 ` Leo Brewin
2017-03-19 7:00 ` Keith Thompson
2017-03-19 12:05 ` Per Sandberg
2017-03-19 18:39 ` hreba
2017-03-19 19:22 ` Simon Wright
2017-03-19 19:49 ` hreba
2017-03-19 23:53 ` Simon Wright
2017-03-20 11:12 ` hreba
2017-03-20 14:04 ` hreba
2017-03-22 11:21 ` hreba
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox