title: Numpy setup error : extra formal argument
body: <p>I have some Fortran files I would like to use in Python files. I have used the command C:\Python27\python.exe setup.py build_ext --inplace --fcompiler=g95. My setup.py file contains the following code:  </p>
  
  <pre><code>import sys, os
  extra_link_args = []
  extra_link_args = ['-framework', 'accelerate']
  from numpy.distutils.core import setup, Extension
  opt_flags = ['-g', '-fbounds-check', '-I/usr/include/']
  files1 = ['particle_solvers/fbsl_sim_fmod.f90',
            'particle_solvers/fbsl_parts_fmod.f90',
            'particle_solvers/fbsl_poisson_fmod.f90',
            'particle_solvers/fbsl_convol_fmod.f90',
            'particle_solvers/fbsl_lbfr_parts_fmod.f90',
            'particle_solvers/fbsl_ltp_parts_fmod.f90',
            'particle_solvers/fbsl_pusher_fmod.f90',
            ]
  ext1 = Extension(name='_fbsl_f90',
                   sources=files1,
                   extra_compile_args=opt_flags,
                   extra_link_args=extra_link_args)
  setup(name="_fbsl_f90",
        version='0.1',
        description="Hidden",
        author="Hidden",
        author_email='Hidden',
        url='',
        ext_modules=[ext1])
  </code></pre>
  
  <p>But I have got the following errors :</p>
  
  <pre><code>g95.exe:f90: build\src.win32-2.7\_fbsl_f90-f2pywrappers2.f90
  In file build\src.win32-2.7\_fbsl_f90-f2pywrappers2.f90:211
       &amp;ef2pywrap, smooth_heaviside, r)
                                     1
  Error: Extra formal argument for 'f2pywrap_fbsl_sim_f90_smooth_heaviside' at (1)
  In file build\src.win32-2.7\_fbsl_f90-f2pywrappers2.f90:13
       &amp;nf2pywrap, t)
                   1
  In file build\src.win32-2.7\_fbsl_f90-f2pywrappers2.f90:217
       &amp;nf2pywrap, f_exact_is_known, t)
                   2
  Error: Differing types REAL(8) and LOGICAL(4) in formal arguments at (1) and (2)
  In file build\src.win32-2.7\_fbsl_f90-f2pywrappers2.f90:223
       &amp;inal_is_knownf2pywrap, f_exact_final_is_known)
                               1
  Error: Extra formal argument for 'f2pywrap_fbsl_sim_f90_f_exact_final_is_known'
  at (1)
  In file build\src.win32-2.7\_fbsl_f90-f2pywrappers2.f90:228
       &amp;2pywrap, f_exact_initial, eta_0, eta_1)
                                         1
  Error: Extra formal argument for 'f2pywrap_fbsl_sim_f90_f_exact_initial' at (1)
  In file build\src.win32-2.7\_fbsl_f90-f2pywrappers2.f90:235
       &amp;, t, eta_0, eta_1)
                    1
  Error: Extra formal argument for 'f2pywrap_fbsl_sim_f90_f_exact' at (1)
  In file build\src.win32-2.7\_fbsl_f90-f2pywrappers2.f90:243
       &amp;rap, f_exact_final, eta_0, eta_1)
                                   1
  Error: Extra formal argument for 'f2pywrap_fbsl_sim_f90_f_exact_final' at (1)
  In file build\src.win32-2.7\_fbsl_f90-f2pywrappers2.f90:250
       &amp;_field_is_givenf2pywrap, velocity_field_is_given)
                                 1
  Error: Extra formal argument for 'f2pywrap_fbsl_sim_f90_velocity_field_is_given'
   at (1)
  In file build\src.win32-2.7\_fbsl_f90-f2pywrappers2.f90:255
       &amp;ine_u0, x0, x1)
                    1
  Error: Extra formal argument for 'f2pywrap_fbsl_sim_f90_affine_u0' at (1)
  In file build\src.win32-2.7\_fbsl_f90-f2pywrappers2.f90:262
       &amp;ine_u1, x0, x1)
                    1
  Error: Extra formal argument for 'f2pywrap_fbsl_sim_f90_affine_u1' at (1)
  In file build\src.win32-2.7\_fbsl_f90-f2pywrappers2.f90:269
       &amp;p, quadratic_u0, t, x0, x1)
                                1
  Error: Extra formal argument for 'f2pywrap_fbsl_sim_f90_quadratic_u0' at (1)
  In file build\src.win32-2.7\_fbsl_f90-f2pywrappers2.f90:277
       &amp;p, quadratic_u1, t, x0, x1)
                                1
  Error: Extra formal argument for 'f2pywrap_fbsl_sim_f90_quadratic_u1' at (1)
  In file build\src.win32-2.7\_fbsl_f90-f2pywrappers2.f90:285
       &amp;w_0f2pywrap, bwd_affine_flow_0, t, x0, x1)
                                               1
  Error: Extra formal argument for 'f2pywrap_fbsl_sim_f90_bwd_affine_flow_0' at (1
  )
  In file build\src.win32-2.7\_fbsl_f90-f2pywrappers2.f90:293
       &amp;w_1f2pywrap, bwd_affine_flow_1, t, x0, x1)
                                               1
  Error: Extra formal argument for 'f2pywrap_fbsl_sim_f90_bwd_affine_flow_1' at (1
  )
  In file build\src.win32-2.7\_fbsl_f90-f2pywrappers2.f90:301
       &amp;ic_flow_0f2pywrap, bwd_quadratic_flow_0, t, x0, x1)
                                                        1
  Error: Extra formal argument for 'f2pywrap_fbsl_sim_f90_bwd_quadratic_flow_0' at
   (1)
  In file build\src.win32-2.7\_fbsl_f90-f2pywrappers2.f90:309
       &amp;ic_flow_1f2pywrap, bwd_quadratic_flow_1, t, x0, x1)
                                                        1
  Error: Extra formal argument for 'f2pywrap_fbsl_sim_f90_bwd_quadratic_flow_1' at
   (1)
  In file build\src.win32-2.7\_fbsl_f90-f2pywrappers2.f90:317
       &amp;0, x1)
           1
  Error: Extra formal argument for 'f2pywrap_fbsl_sim_f90_bggk_a' at (1)
  error: Command "C:\Users\QUENTIN\bin\g95.exe -fno-second-underscore -O -Ibuild\s
  rc.win32-2.7 -IC:\Python27\lib\site-packages\numpy\core\include -IC:\Python27\in
  clude -IC:\Python27\PC -c -c build\src.win32-2.7\_fbsl_f90-f2pywrappers2.f90 -o
  build\temp.win32-2.7\Release\build\src.win32-2.7\_fbsl_f90-f2pywrappers2.o -fmod
  =build\temp.win32-2.7\Release\ -Ibuild\temp.win32-2.7\Release\" failed with exit
   status 1
  </code></pre>
  
  <p>I don't understand why I have those Extra formal argument errors. How can I fix them ? I am working on Windows 7 with Python 2.7 and g95 compiler.</p>
  
  <p>EDIT : Okay, to simplify, here is a sample of my Fortran code :</p>
  
  <pre><code>module test_f90
  
  implicit none
  
  real *8 :: delta
  
  contains
  
  real*8 function test_f(r)
      real*8, intent(in) :: r
      test_f = 0.5*( 1 + erf(r/delta) )
  end function
  
  end module test_f90
  </code></pre>
  
  <p>When I use the command C:\Python27\python.exe setup.py build_ext --inplace --fcompiler=g95 with this setup.py file :</p>
  
  <pre><code>import sys
  
  extra_link_args = []
  
  from numpy.distutils.core import setup, Extension
  
  opt_flags = ['-g', '-fbounds-check', '-I/usr/include/']
  
  
  files1 = ['test_fmod.f90',
            ]
  
  
  ext1 = Extension(name='_test_f90',
                   sources=files1,
                   extra_compile_args=opt_flags,
                   extra_link_args=extra_link_args)
  
  
  setup(name="_test_f90",
        version='0.1',
        description="test module",
        author="Hidden",
        author_email='Hidden',
        url='',
        ext_modules=[ext1])
  </code></pre>
  
  <p>I have got this Fortran file generated by f2py :</p>
  
  <pre><code>!     -*- f90 -*-
  !     This file is autogenerated with f2py (version:2)
  !     It contains Fortran 90 wrappers to fortran functions.
  
        subroutine f2pywrap_test_f90_test_f (test_ff2pywrap, r)
        use test_f90, only : test_f
        real(kind=8) r
        real(kind=8) test_ff2pywrap
        test_ff2pywrap = test_f(r)
        end subroutine f2pywrap_test_f90_test_f
  
        subroutine f2pyinittest_f90(f2pysetupfunc)
        use test_f90, only : delta
        interface 
        subroutine f2pywrap_test_f90_test_f (test_ff2pywrap, test_f, r)
        real(kind=8) test_f
        real(kind=8) r
        real(kind=8) test_ff2pywrap
        end subroutine f2pywrap_test_f90_test_f
        end interface
        external f2pysetupfunc
        call f2pysetupfunc(delta,f2pywrap_test_f90_test_f)
        end subroutine f2pyinittest_f90
  </code></pre>
  
  <p>but I still have this error : </p>
  
  <pre><code>g95.exe:f90: build\src.win32-2.7\_test_f90-f2pywrappers2.f90
  In file build\src.win32-2.7\_test_f90-f2pywrappers2.f90:15
  
        subroutine f2pywrap_test_f90_test_f (test_ff2pywrap, test_f, r)
                                                                     1
  Error: Extra formal argument for 'f2pywrap_test_f90_test_f' at (1)
  error: Command "C:\Users\QUENTIN\bin\g95.exe -fno-second-underscore -O -Ibuild\s
  rc.win32-2.7 -IC:\Python27\lib\site-packages\numpy\core\include -IC:\Python27\in
  clude -IC:\Python27\PC -c -c build\src.win32-2.7\_test_f90-f2pywrappers2.f90 -o
  build\temp.win32-2.7\Release\build\src.win32-2.7\_test_f90-f2pywrappers2.o -fmod
  =build\temp.win32-2.7\Release\ -Ibuild\temp.win32-2.7\Release\" failed with exit
   status 1
  </code></pre>