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.8 required=5.0 tests=BAYES_00,INVALID_DATE autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,7f9c4ba3b0dc13ca X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 1994-12-13 19:19:05 PST Newsgroups: comp.lang.ada Path: bga.com!news.sprintlink.net!howland.reston.ans.net!europa.eng.gtefsd.com!news.mathworks.com!noc.near.net!inmet!dsd!bobduff From: bobduff@dsd.camb.inmet.com (Bob Duff) Subject: Re: Addressing functions Message-ID: Sender: news@inmet.camb.inmet.com Organization: Intermetrics, Inc. References: <3citrc$bb5@earth.usa.net> Date: Tue, 13 Dec 1994 19:04:15 GMT Date: 1994-12-13T19:04:15+00:00 List-Id: In article <3citrc$bb5@earth.usa.net>, Bill Buckley wrote: > > ...I know I can get the address of a subprogram via the ADDRESS >attribute in Ada but can not figure a way to use it. In Ada83, there is no portable way to call such a subprogram. If you know the machine-level calling conventions used by your compiler, you can write a machine code insertion that does, but that's pretty nasty. In Ada 9X, you can use access-to-subprogram types: type String_Procedure is access procedure (S: String); X: String_Procedure := Text_IO.Put'Access; Now you can call X like this: X("Hello, world"); which means the same as this: X.all("Hello, world"); -- Bob Duff bobduff@inmet.com Oak Tree Software, Inc. Ada 9X Mapping/Revision Team (Intermetrics, Inc.)