From: CSBVAX::MRGATE!@KL.SRI.Com:info-vax-request@kl.sri.com@SMTP 15-JUL-1987 18:05 To: EVERHART Subj: Re: Help Request Received: from ucbvax.Berkeley.EDU by KL.SRI.COM with TCP; Tue 14 Jul 87 17:35:04-PDT Received: by ucbvax.Berkeley.EDU (5.58/1.27) id AA24210; Mon, 13 Jul 87 21:32:57 PDT Received: from USENET by ucbvax.Berkeley.EDU with netnews for info-vax@kl.sri.com (info-vax@kl.sri.com) (contact usenet@ucbvax.Berkeley.EDU if you have questions) Date: 13 Jul 87 19:25:08 GMT From: hp-sdd!ucsdhub!jack!man!crash!jeh@hplabs.hp.com (Jamie Hanrahan) Organization: Crash TS, El Cajon, CA Subject: Re: Help Request Message-Id: <1382@crash.CTS.COM> References: <8707110230.AA28524@ucbvax.Berkeley.EDU>, <1368@crash.CTS.COM> Sender: info-vax-request@kl.sri.com To: info-vax@kl.sri.com In a private communication, Jerry Leichter writes: > [In response to a comment of mine on the lack of any certain way of > determining the address of the END of a FORTRAN function, Mr. Hanrahan > writes: ] > > VAX-11 FORTRAN supports the ENTRY statement ... Thus, you can ... > > > > INTEGER*4 FUNCTION LOCKED_FUNC (ARG, ...) > > - > > - > > (declarations, code, etc.) > > - > > - > > ENTRY LOCKED_FUNC_END (ARG, ...) > > END > > > > ... [and] use %LOC(LOCKED_FUNC) and %LOC(LOCKED_FUNC_END) to get the > > addresses of the beginning and end of the procedure. > > Again, this will PROBABLY work, but there is NOTHING in any FORTRAN definition > I know of that specifies where the code generated for an ENTRY statement will > actually be placed. The fact that control will enter the function just after > the entry statement is irrelevant - the compiler can allocate the actual entry > code anywhere it likes, then provide a branch to the appropriate point within > the function. ... Hot damn, he's right! The trick of using %LOC on an ENTRY name came from the DEC Ed. Svcs. handout for the "Programming VMS in VAX-11 Fortran/ Macro", ca. 1980... and I've never seen it fail... but I don't recall seeing anything in the "official" VAX Fortran doc. that guarantees ordering of ENTRY points. Well, here's a trick that will work: Put the function to be locked in a source file by itself. Put another dummy function in another source file. Compile them independently to produce two separate object files. Then use the Linker CLUSTER options command to specify the order in which to read the two files. Sigh!