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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,34e28efa1a88ae84 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!news3.google.com!feeder1-2.proxad.net!proxad.net!feeder2-2.proxad.net!newsfeed.arcor.de!newsspool3.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Access procedure to pointer Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <483C48B5.9060303@gmail.com> Date: Tue, 27 May 2008 20:26:58 +0200 Message-ID: NNTP-Posting-Date: 27 May 2008 20:27:00 CEST NNTP-Posting-Host: 9ddeadfe.newsspool4.arcor-online.net X-Trace: DXC=l]JI0IVCK62QbA1[CgMQ004IUK\BH3Y26mMXSXEPgl9DNcfSJ;bb[5IRnRBaCdSVbcafgJP1;Mkck3gaZ2=7 X-Complaints-To: usenet-abuse@arcor.de Xref: g2news1.google.com comp.lang.ada:400 Date: 2008-05-27T20:27:00+02:00 List-Id: On Tue, 27 May 2008 17:45:25 +0000, in comp.lang.ada you wrote: > Ludovic Brenta a �crit : >> procedure Foo; >> >> Access_Foo : constant access procedure := Foo'Access; >> >> Foo_Address : constant System.Address := Foo'Address; >> Foo_Address : constant System.Address := Access_Foo.all'Address; >> > > It was refused by the compiler, "subtype mark is required here". Egh? It the following should work: procedure Foo; pragma Convention (C, Foo); -- You deal with C, right? Ptr : constant Address := Foo'Address; > I succeed using an unchecked conversion, looks like access to a > procedure has the same size than System.address since I didn't get any > warning. I would suggest a cleaner: type Callback is access procedure; pragma Convention (C, Callback); procedure Foo; pragma Convention (C, Foo); Ptr : constant Callback := Foo'Access; Callback is an equivalent to C pointer to a function. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de