Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!columbia!rutgers!lll-lcc!pyramid!batcomputer!tedcrane From: tedcrane@batcomputer.tn.cornell.edu (Ted Crane) Newsgroups: comp.os.vms Subject: Re: Accessing global variable from FORTRAN Message-ID: <863@batcomputer.tn.cornell.edu> Date: Fri, 1-May-87 12:19:44 EDT Article-I.D.: batcompu.863 Posted: Fri May 1 12:19:44 1987 Date-Received: Sun, 3-May-87 01:48:05 EDT References: <8704300556.AA02237@ucbvax.Berkeley.EDU> Reply-To: tedcrane@tcgould.tn.cornell.edu.UUCP (Ted Crane) Distribution: world Organization: Program of Computer Graphics, Cornell University Lines: 31 In article <8704300556.AA02237@ucbvax.Berkeley.EDU> KND@DHDMPI5.BITNET writes: > >I would like to access a location in a MACRO Subroutine from a FORTRAN >Main Program and don't want to use a COMMON for that. >The location in MACRO is defined as follows : > > LABEL:: .WORD number > >The %LOC function in FORTRAN gives me the ADDRESS of 'LABEL'. But how >can I get the contents of 'LABEL' ? It is most likely that you will have to write a subroutine or function to do this: subroutine MOVE_GLOBAL(IN,OUT) integer*2 IN,OUT OUT = IN end and call it: call MOVE_GLOBAL(%val(LABEL),RESULT) (You can extrapolate the function call form of this) The interesting thing is that using VAX FORTRAN, the global variable need not be a simple tpye such as . All that is necessary is to declare the global variable appropriately in the subroutine/ function. It could be an array or a structure. You could return any value at all, whether it is one array element, a field from a structure, or something calculated.