[SciPy-user] import/include in f2py

Robert Kern robert.kern at gmail.com
Sat Apr 22 20:04:40 CDT 2006

Ryan Krauss wrote:
> If I have a user-defined function in a seperate .f or .so file, how do
> I include that function in another fortran file for use with f2py?
> i.e. if I define:
>       double complex function zcosh(z)
>       double complex z
>       zcosh = 0.5*(exp(z)+exp(-z))
>       RETURN
>       END
> in mylib.f
> and then I want to use it like this:
>       double complex function bode(s)
>       double complex s
>       double complex zsinh, zcosh
> in bode(s) in otherfile.f, what line(s) do I need in otherfile.f to
> make it find zcosh(z)?

None. Just link the object files during linking.

> I guess I am asking what is the fortran equivalent of include from c
> or import in python?

There is none.

Robert Kern
robert.kern at gmail.com

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco

More information about the SciPy-user mailing list