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,XPRIO autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,82bafc3cbf94e0b,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-11-09 09:54:44 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!canoe.uoregon.edu!arclight.uoregon.edu!wn13feed!worldnet.att.net!204.127.198.203!attbi_feed3!attbi.com!sccrnsc02.POSTED!not-for-mail From: "SteveD" Newsgroups: comp.lang.ada Subject: Can the main procedure be a generic instance? X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 Message-ID: NNTP-Posting-Host: 12.211.13.75 X-Complaints-To: abuse@attbi.com X-Trace: sccrnsc02 1036864484 12.211.13.75 (Sat, 09 Nov 2002 17:54:44 GMT) NNTP-Posting-Date: Sat, 09 Nov 2002 17:54:44 GMT Organization: AT&T Broadband Date: Sat, 09 Nov 2002 17:54:44 GMT Xref: archiver1.google.com comp.lang.ada:30658 Date: 2002-11-09T17:54:44+00:00 List-Id: I have defined a generic package gen_main as follows: ---------- File: gen_main.ads ---------- with ada.Text_io; package Gen_Main is generic number_of_times : integer; procedure Gen; end Gen_Main; ---------------------------------------- ---------- File: gen_main.adb ---------- with ada.Text_io; package body Gen_Main is procedure Gen is begin for count in 1 .. Number_of_times loop Ada.Text_Io.Put_Line( "Count = " & Integer'Image( count ) ); end loop; end Gen; end Gen_Main; ---------------------------------------- I create an instance of the generic ---------- File: main.adb ---------- with gen_main; procedure main is new gen_Main.Gen( 10 ); ----------------------------------- This program builds and runs under ObjectAda 7.2 as expected. Using Gnat 3.14p, I get the error: D:\>gnatmake -v Main GNATMAKE 3.14p (20010503) Copyright 1995-2001 Free Software Foundation, Inc. "main.ali" being checked ... -> "main.ali" missing. gcc -c main.adb main.adb:2:11: warning: file name does not match unit name, should be "main.ads" main.adb:2:11: generic instantiation for "main" does not allow a body main.adb:2:11: remove incorrect body in file "main.adb" End of compilation gnatmake: "main.adb" compilation error Should this work? SteveD