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,d50803f457a25d9 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!news2.google.com!fu-berlin.de!uni-berlin.de!not-for-mail From: "Nick Roberts" Newsgroups: comp.lang.ada Subject: Re: GtkAda Problem Date: Sat, 17 Jul 2004 21:00:38 +0100 Message-ID: References: <1udKc.98748$dP1.333832@newsc.telia.net> Mime-Version: 1.0 Content-Type: text/plain; format=flowed; delsp=yes; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: news.uni-berlin.de 0fwXUmc/GAw2lTe1mAdkYQODLUwdojOhTYfVmceA/RScwhe58= User-Agent: Opera M2/7.51 (Win32, build 3798) Xref: g2news1.google.com comp.lang.ada:2211 Date: 2004-07-17T21:00:38+01:00 List-Id: On Sat, 17 Jul 2004 17:38:05 GMT, Bj�rn Persson wrote: > Oliver Doerler wrote: > >> fidle_id := Gtk.Main.Idle_Add (fidle'access); >> gnatmake Message: >> =>subprogram must not be deeper than access type > > Did you declare fidle inside the main subprogram? Move it to a package. > Idle_Callback is defined on what is called the library level. It's not > allowed to point to something on a deeper level, and what's inside a > subprogram is deeper. The rule is there to prevent pointers from > pointing to something that can go out of scope and disappear before the > pointer goes out of scope. > > I think most beginners try to do this and get confused. I know I did. If it is possible to move fidle to a library-level package, fine. But if it would be impractical to do so, I suspect using Unchecked_Access is the best bet. -- Nick Roberts