Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!rutgers!dayton!joe From: joe@dayton.UUCP (Joseph P. Larson) Newsgroups: comp.lang.fortran Subject: Re: Can a subroutine find the name of the calling routine? Message-ID: <702@dayton.UUCP> Date: Fri, 1-May-87 09:13:26 EDT Article-I.D.: dayton.702 Posted: Fri May 1 09:13:26 1987 Date-Received: Sun, 3-May-87 01:52:16 EDT References: <13160003@acf4.UUCP> Reply-To: joe@dayton.UUCP (Joseph P. Larson) Organization: Dayton-Hudson Dept. Store Co. Lines: 24 In article <13160003@acf4.UUCP> woo@acf4.UUCP (Alex C. Woo) writes: > >Is there anything comparable to getarg and iargc for subroutines >or functions? How can a function determine the name of the function >which calls it or the number of calling arguments, either in C >or f77? This kind of thing is compiler- (and perhaps machine-) dependant. DEC FORTRAN won't tell you, for instance. I suspect most compilers won't give you the name of the function or subroutine for the simple reason that this means it would also have to keep this info in a table. If you then strip the program (an obvious UNIX term), your program is unlikely to work anymore. As for the number of arguments -- that's going to be dependent on your machine and compiler, as well. If you can't find the info, you might be able to write an assembly-language routine that will look at the info on the stack -- what you are looking for just might be there. -- UUCP: rutgers!dayton!joe Dayton Hudson Department Store Company ATT : (612) 375-3537 Joe Larson/MIS 1060 (standard disclaimer...) 700 on the Mall Mpls, Mn. 55408