From: Andi Stephens on

My program encodes several different methods
for doing the same thing.

I'd like to choose among them at runtime, and
in some languages I'd set a pointer to the
chosen function, and then reference the pointer
for each function call.

Is there a way to do this in Fortran?

Thanks,

--Andi
From: Beliavsky on

Andi Stephens wrote:
> My program encodes several different methods
> for doing the same thing.
>
> I'd like to choose among them at runtime, and
> in some languages I'd set a pointer to the
> chosen function, and then reference the pointer
> for each function call.
>
> Is there a way to do this in Fortran?

Yes, using the "procedure pointer" of Fortran 2003. It has been
implemented in g95, and you can search "procedure pointer" in the gg95
newsgroup http://groups.google.com/group/gg95 for an example of its use.