From: hreba <f_hreba@yahoo.com.br>
Subject: Re: Interfaces.C questions
Date: Sun, 19 Mar 2017 19:39:02 +0100
Date: 2017-03-19T19:39:02+01:00 [thread overview]
Message-ID: <ej81i5F6f41U1@mid.individual.net> (raw)
In-Reply-To: <ej31ppF6c01U1@mid.individual.net>
A crude, pure interface version for a GSL quadrature function works. Now
I have unexpected difficulties with a wrapper, which is a generic package:
generic
type Real is digits <>;
type Parameters is private;
package GSL is
type Real_Function is access function (x: Real) return Real;
...
The package body contains the following lines, everything on library level:
type GSL_Function is record
func: access -- this is line 21
function (x: C.double; params: Void_Ptr) return C.double;
params: Void_Ptr;
end record;
pragma Convention (C, GSL_Function);
real_func: Real_Function;
----%<----------------------------------------------------------
function func (x: C.double; params: Void_Ptr) return C.double is
begin
return C.double (real_func (Real(x)));
end func;
pragma Convention (C, func); -- this is line 37
Later, within a procedure body:
gslf: aliased GSL_Function;
begin
gslf.func:= func'Access; -- this is line 66
...
I get the following compiler messages and understand nothing:
gsl.adb:37:04: pragma "CONVENTION" requires separate spec and must come
before body
gsl.adb:66:19: subprogram "func" has wrong convention
gsl.adb:66:19: does not match access to subprogram declared at line 21
- Separate spec? How?
Before body? All my other CONVENTION pragmas come after the
subprogram body, without any problem.
- No match? Where is the difference?
--
Frank Hrebabetzky +49 / 6355 / 989 5070
next prev parent reply other threads:[~2017-03-19 18:39 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
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 [this message]
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