From: tmoran@acm.org
Subject: Re: Passing arrays to procedures
Date: Wed, 22 Dec 2004 13:34:09 -0600
Date: 2004-12-22T13:34:09-06:00 [thread overview]
Message-ID: <IPWdnbdgIdCsUVTcRVn-vw@comcast.com> (raw)
In-Reply-To: cqcf7o$kbu$03$1@news.t-online.com
> in the seperate procedure-file, because there is no way to declare sth
>before the procedure starts.
You need to put the array and procedure declarations together in a
public package, eg
package Processing is
type Blah is array (Integer range <>) of ...
procedure Procname (N : in Integer; v1 : in Blah);
end Processing;
and then the (private) body of the callee goes in the package body:
package body Processing is
procedure Procname (N : in Integer; v1 : in Blah) is
...
end Procname;
end Processing;
Then the caller will look something like
with Processing;
procedure Main is
X : Processing.Blah(1 .. 10);
begin
Processing.Procname(17, X);
-- or
Processing.Procname(N=>17, v1=>X);
>I already tried to declare both proedures in one file but then it sais
>sth like "end of file expected" after the "end;" of the first of these
The Ada language is not defined in terms of files, but rather in terms
of (separately compilable) "compilation units" - eg packages, library
level procedures, and some other stuff. Some compilers (eg, GNAT) impose
a restriction that a single file can contain only a single compilation
unit. I'm guessing you're using GNAT and that's why you get that
error message.
next prev parent reply other threads:[~2004-12-22 19:34 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-12-22 14:34 Passing arrays to procedures xadian
2004-12-22 15:09 ` Alex R. Mosteo
2004-12-22 18:43 ` xadian
2004-12-22 19:34 ` tmoran [this message]
2004-12-22 21:03 ` Martin Krischik
2004-12-23 0:50 ` Jeffrey Carter
2004-12-22 16:20 ` Martin Krischik
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox