[SciPy-Dev] f2py, the fortran integer type, and npy_intp

Charles R Harris charlesr.harris@gmail....
Sat Jul 10 17:31:10 CDT 2010


On Sat, Jul 10, 2010 at 3:49 PM, Sturla Molden <sturla@molden.no> wrote:

> Charles R Harris skrev:
> > I note that some c programs try to call f2py generated fortran
> > interfaces using the npy_intp type for the array dimension. There are
> > two problems here, first the prototype for the generated wrapper uses
> > int causing compiler warnings on a 64 bit os, and second, the fortran
> > subroutines themselves use integer types. So some questions. What
> > precision are fortran integers?
> Precision is determined by the kind number, which is implementation
> dependent. In other words, "you cannot know". The only portable solution
> to this is to use Fortran 2003 C bindings. The Fortran compiler knows
> it's own internal details.
>
>
I don't think the bindings don't help, we need to have the default integers
in the existing pre-FORTRAN77 code in scipy compiled as Py_ssize_d, and then
f2py needs to be modified to generate appropriate Python bindings. That's a
lot of work. Even with the bindings I think one would need to have a script
to rewrite the FORTRAN code since the c-type corresponding to Py_ssize_d
isn't fixed.

Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-dev/attachments/20100710/7c724931/attachment.html 


More information about the SciPy-Dev mailing list