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.7 required=5.0 tests=BAYES_00,INVALID_DATE, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 Xref: utzoo comp.lang.ada:2604 comp.sw.components:120 Path: utzoo!attcan!utgpu!watmath!att!dptg!rutgers!apple!bionet!agate!shelby!decwrl!decvax!ima!cfisun!stellar!arra From: arra@stellar.COM (Arra Avakian @stellar) Newsgroups: comp.lang.ada,comp.sw.components Subject: Re: Pointers to code Keywords: Dynamic binding, Ada Message-ID: <1989Aug30.210759.3267@stellar.COM> Date: 30 Aug 89 21:07:59 GMT References: <6333@hubcap.clemson.edu> <6341@hubcap.clemson.edu> Reply-To: arra@stellar.com Organization: Stellar Computer, Newton MA List-Id: Bill Wolfe, wtwolfe@hubcap.clemson.edu, writes in referencing to calling a function given its address: > ... The major restriction, > then, is not an inability to store a pointer to a function in a record > type; rather, it is the fact that there is not a mechanism which can > express the desire to invoke the function residing at that address; > the 9X proposed revision would therefore provide such a mechanism. > It seems there is a syntax in Ada for calling a subprogram, given its address at run time. However, it depends upon an interpretation of an address clause for a subprogram that may not be what was intended in the ARM (13.5), paragraph 5: "b) Name of a subprogram, package, or task unit: the address that is required for the machine code associated with the body of the program unit." I believe that was is intended is that the corresponding body, which is expected to occur later, will be placed in some system dependent manner by a linker/loader at the given (presumably static) address. However, another interpretation is that the body will NOT be supplied in Ada, but that the machine code for it will be found at the given (possibly non-static) address. So here it is (a different version for every signature is required, only one example given): -- -- "call(p,i)" will call a procedure given by address "p" with argument "i" -- with SYSTEM; procedure CALL(PROC: SYSTEM.ADDRESS; ARG: INTEGER) is -- Define a dummy procedure at address "PROC" procedure DUMMY(I: INTEGER); for DUMMY use at PROC; begin DUMMY(I => ARG); end CALL; ========================= arra@stellar.com Arra Avakian Stellar Computer Inc 95 Wells Ave Newton, MA 02159 (617) 964-1000 xt 288