[f2py] Passing a fortran character array to a python callback

Mark mesmith.15507218 at bloglines.com
Fri Apr 28 23:38:12 EEST 2006


Should a fortran character array be a legitimate argument to a python 
callback? I have fortran that looks something like this

       subroutine error()
       character*1 errlvl
       integer nlines
c These lines are here to get the correct settings into sig.pyf
cf2py  intent(callback, hide) py_errmsg
cf2py optional py_errmsg

       external py_errmsg

       call py_errmsg(errlvl, nlines)
       return
       end

I get gcc errors like this

module.c: In function `py_errmsg_':
module.c:450: error: too few arguments to function

line 450 in module.c is
   (*cb_py_errmsg_in_error__user__routines_cptr)(errlvl,nlines_cb_capi);

and a few lines above (at line 426)...
    extern void F_FUNC_US(py_errmsg,PY_ERRMSG) (string errlvl,int 
*nlines_cb_capi,int errlvl_cb_len)

I can see that the length of the string appears as an argument in line 
426, but not line 450. Is that the problem and how do I make f2py 
include the string length on line 450?

Thanks,
Mark



More information about the f2py-users mailing list