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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,b7ecd0508d245308,start X-Google-Attributes: gid103376,public From: bond@ee.ubc.ca (Greg Bond) Subject: Subprogram access types and generic packages Date: 1997/03/18 Message-ID: #1/1 X-Deja-AN: 226565292 Organization: Dept. of Electrical Eng., UBC Newsgroups: comp.lang.ada Date: 1997-03-18T00:00:00+00:00 List-Id: I'm trying to write a generic package that will register an access type of one of its internal subprograms with an external subprogram when instantiated. I get the error message: pkg.adb:12:14: access type must not be outside generic body Why not? Here's a simple bit of code that generates this error: (gnatmake access_test) -------------------------------------------------- access_test.adb -------------------------------------------------- with Pkg; procedure Access_Test is Val: constant Integer := 10; package Test is new Pkg (Val); use Test; begin null; end Access_Test; -------------------------------------------------- pkg.ads -------------------------------------------------- generic Const: Integer; package Pkg is pragma Elaborate_Body (Pkg); end Pkg; -------------------------------------------------- pkg.adb -------------------------------------------------- with Reg; use Reg; package body Pkg is procedure Proc is begin null; end Proc; begin Register (Proc'Access); end Pkg; -------------------------------------------------- reg.ads -------------------------------------------------- package Reg is type Proc_Alias is access procedure; procedure Register (Proc: Proc_Alias); end Reg; -------------------------------------------------- reg.adb -------------------------------------------------- package body Reg is procedure Register (Proc: in Proc_Alias) is begin null; end Register; end Reg; -- * Greg Bond * Dept. of Electrical and Computer Eng. * email: bond@ee.ubc.ca * Univ. of British Columbia * voice: (604) 822 0899 * 2356 Main Mall * fax: (604) 822 5949 * Vancouver, BC * web: http://www.ee.ubc.ca/~bond * Canada, V6T 1Z4