Skip to content

Calling a function with no parameters #60

@malkab

Description

@malkab

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions