comp.lang.ada
 help / color / mirror / Atom feed
From: bobduff@world.std.com (Robert A Duff)
Subject: Re: Are 'pragma Export' and access types mutually exclusive?
Date: 1997/08/08
Date: 1997-08-08T00:00:00+00:00	[thread overview]
Message-ID: <EEMBnB.3E8@world.std.com> (raw)
In-Reply-To: 33EBA058.5680@mathworks.com


In article <33EBA058.5680@mathworks.com>,
Tom Weis  <tom_weis@mathworks.com> wrote:
>   procedure Integer_Procedure1(Arg_In : in out Integer);
>   procedure Integer_Procedure2(Arg_In : in out Integer);
>   pragma Export(C, Integer_Procedure2,
>                    "Integer_Procedure2");
> 
>   type fcn_access
>     is access procedure (Arg_In: in out Integer);
> 
>   fcn1 : fcn_access := Integer_Procedure1'access;
>   fcn2 : fcn_access := Integer_Procedure2'access;

You need to make the access type have the same calling convention as the
subprograms.  By default, fcn_access has convention Ada, so use "pragma
Convention(C, fcn_access);".  You will then need to use pragma
Convention on Integer_Procedure1, too.

If X is of type fcn_access, then when the compiler sees a call to X.all,
it needs to know where to put the parameters and so forth -- that is, it
needs to know the calling convention.  It can't be both C and Ada -- it
has to be one or the other.  The compiler doesn't know where that access
value came from, so the matching-conventions rule is necessary.

- Bob




  reply	other threads:[~1997-08-08  0:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-08-08  0:00 Are 'pragma Export' and access types mutually exclusive? Tom Weis
1997-08-08  0:00 ` Robert A Duff [this message]
1997-08-09  0:00 ` Robert Dewar
replies disabled

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