comp.lang.ada
 help / color / mirror / Atom feed
From: Dirk Heinrichs <dirk.heinrichs@altum.de>
Subject: Re: Procedure defined in package body accessed by separate procedure
Date: Thu, 13 Feb 2014 17:32:53 +0100
Date: 2014-02-13T17:32:53+01:00	[thread overview]
Message-ID: <ldis43$5k5$1@online.de> (raw)
In-Reply-To: aae6105c-fb90-42f0-b87e-6d38122fd64c@googlegroups.com

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

ashwath30jul77@gmail.com wrote:

> Hello,
> I am getting an error when a procedure(say Pr1) defined in a separate file
> invokes a procedure defined in the package(say Pk1) body(say Pr2). The
> compiler gives error saying that Pr2 is not declared in Pk1.
> 
> Please let me know what is the mistake I am doing.
> 
> Snapshots of source code is shown for better clarity.
> 
> Greetings.ads:
> =============================
> package Greetings is
> 
>    procedure Hello;
>    procedure Goodbye;
> 
> end Greetings;
> 
> Greetings.adb:
> ==============================
> with text_io;
> use Text_IO;
> 
> package body Greetings is
> 
>    procedure Hello is separate;
>    procedure Goodbye is separate;
>    procedure proc_body is
>    begin
>       put_line("body");
>    end;
> end Greetings;
> 
> Greetings-Hello.ada:
> ================================
> with text_io;
> use Text_IO;
> separate (Greetings)

Should be "with Greetings;"
 
> 
> procedure Hello is
> begin
>    put_line("Hello");
>    Greetings.proc_body;--Compiler error here. Says proc_body is not
>    declared in Greetings

Which is correct, because it's not in the spec. As long as it's in the body 
only, you can't call it from other packages.

HTH...

	Dirk
- -- 
Dirk Heinrichs <dirk.heinrichs@altum.de>
Tel: +49 (0)2471 209385 | Mobil: +49 (0)176 34473913
GPG Public Key CB614542 | Jabber: dirk.heinrichs@altum.de
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.14 (GNU/Linux)

iQIVAwUBUvzztcwdtL3LYUVCAQpfDw//Wug+tl7zoj09/08NM/gXxB2kJnThKgdN
XzGbqST33GWFyVLv7nVMYHcDfn6leXkPWGh6RZ60X6khq2j/nZ3l0LkxibrmmUIJ
hqQFegF9op0i5Y1axHZ5X7yJXZtpK6repwlVrrrSwQPqfkIjDIibfSHydzRTeiLX
b59Q0utjOMGd/4isJjyZ4M+oO6VodfOmJEtbap0hNcCBHHA62NEgEhd85Sh+ixdW
BWsV6Dw7Libd0iiSuhOdU2r+kSOvOz3nqd2nonW7uKLICDgxrJojqzTnebkeSNwP
y4T5UH7/T1VrBpUqTsC8I6Pmh54y9S3ar6G+jLL8ClYILPGXUiwkmUZ+S13TEtn3
9Q4oLNzqOSlYFc7TChhio3WGahk4A0aD2LQXwTwAD9tlhRphTa80+RvaAX31X3Aw
qQUC8A3lQ7/+6eV8P0Bd+S7TPKSYcAcB7RsMx+JeihYT1XS2U0cpg0P9sFv6EKmm
2plB6JvExrwBoJ09fB0SpczPt+vCPaMKJ5wVJUtcASYZMIBsVv3m0DaR8usgRe4+
sdw1zprKIer/zBUl+f4SKT+jM34I5bf7ka82uN3ijGHmTLTkTLAhL6RHBcXmTBL/
NdJDQjFMezjsA21plk/OCo888sH6LhdurIkPS/ELRGDxs+D3ZBThGdus4ICxLW5X
B2Zt708/0yM=
=Mqm8
-----END PGP SIGNATURE-----

  parent reply	other threads:[~2014-02-13 16:32 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-13 12:15 Procedure defined in package body accessed by separate procedure ashwath30jul77
2014-02-13 13:58 ` G.B.
2014-02-13 16:54   ` adambeneschan
2014-02-14  6:30     ` ashwath30jul77
2014-02-14  9:22       ` Simon Wright
2014-02-13 16:32 ` Dirk Heinrichs [this message]
2014-02-13 16:43   ` adambeneschan
2014-02-13 16:57     ` Dirk Heinrichs
2014-02-13 16:59       ` Dirk Heinrichs
replies disabled

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