comp.lang.ada
 help / color / mirror / Atom feed
From: "SteveD" <nospam_steved94@attbi.com>
Subject: Re: "extern" procedure in ada
Date: Sat, 28 Sep 2002 03:13:01 GMT
Date: 2002-09-28T03:13:01+00:00	[thread overview]
Message-ID: <179l9.472846$_91.689442@rwcrnsc51.ops.asp.att.net> (raw)
In-Reply-To: an2c4e$52l$1@dns3.cae.ca

"Bernard Azria" <azria@cae.ca> wrote in message
news:an2c4e$52l$1@dns3.cae.ca...
> I am looking for the equivallent of an "extern" definition procedure in
> C for ADA.
>
> In other words, how could I define an external procedure to my program
> without "withing" the package where it is defined ( I have only the "obj'
> and the "ali" file of this procedure in a library)
>

I am still not sure I understand your question, but here is "sort of" an
answer... but I'm not sure it is to your question.

I can declare a variable in an Ada source file and "export" that variable:

package sharer is
  pragma Elaborate_Body;
end sharer;

package body sharer is

  x : integer := 42;
  pragma export( Ada, x );

end sharer;

I can then "import" that variable into another Ada source file:

with Ada.Text_io;
with Sharer;
pragma Elaborate( Sharer );
procedure shared is
  x : Integer;
  pragma import( Ada, x );
begin
  Ada.Text_Io.Put_Line( "x is " & Integer'IMAGE( x ) );
end shared;

In my example I have still With'd the "Sharer" package in so that the "x"
variable will get initialized during elaboration.  But you'll note that
"Sharer" does not explicitly make anything visible in the package spec.

I hope this helps,
SteveD

> Would it be an kind of : pragma import ( ADA, procedure_name )
>
> Thanks in advance
>
> B.A.
>
>
>





  parent reply	other threads:[~2002-09-28  3:13 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-09-27 19:40 "extern" procedure in ada Bernard Azria
2002-09-28  2:28 ` Jim Rogers
2002-09-28  3:13 ` SteveD [this message]
2002-09-28  3:47 ` sk
2002-09-30 14:37 ` Stephen Leake
2002-09-30 22:39   ` Bernard Azria
2002-10-01 19:57     ` Simon Wright
2002-10-02  1:49       ` Jeffrey Carter
2002-10-02 15:13         ` Bernard Azria
2002-10-02 18:56           ` Jeffrey Carter
replies disabled

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