Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!zaphod.mps.ohio-state.edu!swrinde!ucsd!hub.ucsb.edu!ucsbuxa!3003jalp From: 3003jalp@ucsbuxa.ucsb.edu (Applied Magnetics) Newsgroups: comp.lang.fortran Subject: Re: pointer to function in Fortran??? Message-ID: <6558@hub.ucsb.edu> Date: 11 Oct 90 22:32:19 GMT References: Sender: news@hub.ucsb.edu Distribution: comp Lines: 29 In article davis@pacific.mps.ohio-state.edu ("John E. Davis") writes: > What is the easiest way that I can define a variable that points to a >function in fortran? I wish. You can do two things with a subprogram: 1) call it; 2) declare it EXTERNAL and pass it to another subprogram. No assignments, unless you write a primitive in another language and are willing to port it when the time comes. BTW, some machines need more than one word to hold a function pointer. The only all-Fortran solution I can think of is to set up a dispatcher routine: real function F(x) real x integer opcode common/hidden/opcode goto (1,2,3...), opcode 1 F= F1(x) return 2 F= F2(x) return C ... end You use the opcode as a substitute for function pointers. Sigh. --P. Asselin