From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,8f7d6c5172a1d41b X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII Message-ID: <45853BDC.5000902@obry.net> Date: Sun, 17 Dec 2006 13:45:16 +0100 From: Pascal Obry Organization: Home - http://www.obry.net User-Agent: Thunderbird 1.5.0.8 (Windows/20061025) MIME-Version: 1.0 Newsgroups: comp.lang.ada To: Michael Erdmann Subject: Re: How to get around "access type must not be outside generic unit" References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit NNTP-Posting-Date: 17 Dec 2006 13:45:21 CET NNTP-Posting-Host: 82.124.122.163 X-Trace: 1166359521 news.orange.fr 5099 82.124.122.163:1756 X-Complaints-To: abuse@orange.fr Path: g2news2.google.com!news2.google.com!news.germany.com!news.ecp.fr!feed.ac-versailles.fr!fdn.fr!news.wanadoo.fr!news.wanadoo.fr!not-for-mail Xref: g2news2.google.com comp.lang.ada:7929 Date: 2006-12-17T13:45:21+01:00 List-Id: Michael Erdmann a �crit : > gnade@hal:~/test> gnatmake -c usage.adb > gcc -c usage.adb > usage.adb:16:28: access type must not be outside generic unit > gnatmake: "usage.adb" compilation error > > What is the reason for this new compiler check and what can i do > about it? Solution 1) Declare register using an anonymous access type : procedure Register (Str : in String; A : access function return Boolean); Solution 2) Move access to generic spec with Base; use Base; generic type Data_Type is private; package Usage is function Install return Boolean ; procedure Doit( X : in out Data_Type ); Install_Access : P_Access := Install'Access; end Usage; ---- usage.adb with Base; use Base; package body Usage is function Install return Boolean is begin return True; end Install; procedure Doit( X : in out Data_Type ) is begin null; end Doit; begin Register ("Doit", Install_Access); end Usage; package Base is type P_Access is access function return Boolean; procedure Register (Str : in String; A : P_Access); end Base; Pascal. -- --|------------------------------------------------------ --| Pascal Obry Team-Ada Member --| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE --|------------------------------------------------------ --| http://www.obry.net --| "The best way to travel is by means of imagination" --| --| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595