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.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,88e7ef9008757431 X-Google-Attributes: gid103376,public From: Marin David Condic Subject: Re: Function Calls by Address Date: 1999/08/30 Message-ID: <37CAEF6C.197AA467@pwfl.com>#1/1 X-Deja-AN: 519024020 Content-Transfer-Encoding: 7bit Sender: condicma@bogon.pwfl.com References: <37CADE68.6AF06F5D@escmail.orl.lmco.com> <37CAEA5C.11A23940@pwfl.com> X-Accept-Language: en Content-Type: text/plain; charset=us-ascii Organization: Pratt & Whitney Mime-Version: 1.0 Reply-To: e108678@pwflcom Newsgroups: comp.lang.ada Date: 1999-08-30T00:00:00+00:00 List-Id: Marin David Condic wrote: > Craig Jameson wrote: > > > Does any one know how to make dynamic function calls in Ada83. Ooops! I just noticed that you said Ada83. There is no easy way to do this in Ada83. If you look in LRM 13.5, 13.7 and 13.7.2, you will note that there is a way to get at the address to a subprogram. Jumping to that address is likely something you'll have to do with machine instructions or other implementation dependent ways because I don't think the Ada83 standard ever specified a standardized way to use the address as a call or goto. If you're handing off the address to a subsystem that wants to do callbacks, this will also be very system dependent. Getting the parameter lists correct is something with which you are entirely on your own. The thing you will need to look at carefully is your compiler vendor's documentation to see how they suggest using it. (If you post the compiler/target combo, someone may have done this already.) If you can get the 'Address to a subprogram and can figure out how to jump to that address within the system you're in, it should be relatively easy to dynamically build a list of the addresses you're interested in and jumping to them. An Ada feature that I think is underutilized is the ability to do machine instruction insertions so that you can do the things normal programming languages try to stop because they are unsafe or difficult to support. You might look into machine code insertions as a solution to your problem. Between the 'Address attribute and a little assembler code you ought to be able to cobble together a nice isolated chunk of code that lets you do what you want. MDC -- Marin David Condic Real Time & Embedded Systems, Propulsion Systems Analysis United Technologies, Pratt & Whitney, Large Military Engines M/S 731-95, P.O.B. 109600, West Palm Beach, FL, 33410-9600 ***To reply, remove "bogon" from the domain name.*** Visit my web page at: http://www.mcondic.com/