[f2py] incompatible parameter transfer between python and fortran?

Jon <[email protected]> Sun, 31 Oct 2010 16:32:28 -0500
Newsgroups gmane.comp.python.f2py.user
Message-ID <[email protected]>
Hello,

I have the following code, compiled by f2py,

      subroutine hello(n,m)
      implicit none
!      integer, intent(in) :: n
!      integer, intent(out) :: m
      integer n,m
      print*,'hello world ',n
      m = n + 5
      end

and called by python code as

import optim
n=10
m=10
optim.hello(n,m)

The execution result is: the parameter m is not changed, as if only a formal
parameter is transferred to hello,

if I comment out

integer n,m

and restore the two commented statements,

      integer, intent(in) :: n
      integer, intent(out) :: m

then, python complains

TypeError: optim.hello() takes exactly 1 argument (2 given)

It seems that f2py does not recognize the intent(out) parameters in the
fortran code?!

Any idea towards these issues? Thanks a lot!

Jon

_______________________________________________
f2py-users mailing list
f2py-users-Y4l6ocDipWCuvFJfX82//[email protected]
http://cens.ioc.ee/mailman/listinfo/f2py-users