pearu / f2py

Automatically exported from code.google.com/p/f2py
Other
55 stars 39 forks source link

Calling a function with no parameters #60

Open malkab opened 6 months ago

malkab commented 6 months ago

Hi all,

I'm using version 1.26.4 of f2py included with Numpy of the same version.

I'm encountering a problem when trying to wrap a function with no parameters. This is the Fortran code:

real function get_pi()

    get_pi = 3.14159

end function get_pi

This works:

print *, "PI", get_pi()

But when trying to create the F2PY wrapper of the module containing this function I get:

/tmp/tmpnncg5t_b/src.linux-x86_64-3.11/formodtest_mod-f2pywrappers2.f90:12:47:

   12 |       subroutine f2pywrap_formodtest_mod_get_pi (get_pif2pywrap)
      |                                               1
......
   27 |       subroutine f2pywrap_formodtest_mod_get_pi (get_pif2pywrap, get_pi)
      |                                               2
Warning: 'f2pywrap_formodtest_mod_get_pi' has the wrong number of arguments between (1) and (2)

For sure I'm doing something wrong. How can I wrap a function with no parameters?